VIKINGS's Recent Forum Activity

  • I don't know if this applies to you checkmate3 , but I had to deal with similar issues in some of my games where the difference between the levels was quite small code wise(in one case even layout wise) so there really was no need to make a ton of event sheets that had 90% the same code between them.

    In that case what you can do(I found it a bit fiddly and annoying, but it works in the end) is to make as many things variable dependent, for example an every x seconds event, instead of having different every x seconds events and using numbers instead of the x put a variable there "Every SpawnTimer seconds" for example. And you just change that variable depending on what level the player starts.

    You olso wanna use groups and subgroups. Put all your code in one event sheet, but put the parts that change into groups "Level 1 Group", "Level 2 Group", etc. and when you create the groups untick "active at start". Then again you use variable to decide which group/groups will get enabled when the layout starts depending on what level the player just clicked on for example, and so only the code from those groups will run.

    If you wanna see an example of this in action, you have an android and you don't mind spending a bit of time to install a game then you can check out one of my games Kill The Blocks. If you play it, you'll notice it has about 10 different levels, and different things happen in each level, however the levels all use the same layout and the same event sheet!

  • Not as far as I know. You can take a event sheet and include other events sheet in it(right click in a empty space within the event sheet>include event sheet), but then all the events from all the included sheets will run concurrently.

    So if you have duplicate events(maybe with just minor changes) in those event sheets then problems will arise.

  • The phases are at different times LittleStain . Each time an object gets created 1 phase runs. So as you can see from event 3 in the picture the function creates 6 objects one after the other, so 6 phases would run at this time. Sometime later(this is determined by another event I have every x/variable seconds) the function gets called again, 6 new objects get created that push the others down, at this time another 6 phases run(continued from where they left of last time) and so on.

    All families have 5 members each. In total there will be 4 families: MonstersNoSigns, MonstersWithSigns, AmmoNoSigns and AmmoWithSigns. I will be using these families in groups 2 at a time(one group for signs one group for no signs) so at any one time I will be duplicating whatever system you come up with and using it once to spawn monsters and then separately at the same time to spawn the appropiate ammo.

    There is no super important reason why I chose to use families. I just decided on that because it seemed to make part of my randomization and grouping them togheter easier, and because honestly that's what I thought the whole purpose of the family was, to put togheter different things that you plan to use in the same way so you wouldn't have to make a ton of events for each one. And because I'm probably gonna need to put them in families later anyway for other purposes(such as scoring, etc.).

    If you can come up with a better system that doesn't use families(at least for this purpose) that's fine by me, but then you will olso need to show me a reworked version of my spawning system.

  • Well, good for them mindfaQ , but that doesn't really help me with anything. I need a capx(or some screenshots) with how things would be done in C2 following the rules and example I gave in the first post.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Well LittleStain , I guess the most logical(correct me if I'm wrong) course of action in that case would be to skip that combo, don't count/register it as picked(this way the family member won't be taken out of the pool simply for not having enough frames) and try to pick again untill you find a combo that is "valid"/possible. And if there are no more valid combinations left then restart the process.

    Does that make sense?

    P.S. Olso keep in mind that the numbers I use as examples there are actually 1 higher then the numbers of frames. Because I think I read somewhere that floor doesn't pick the last number. So if a animation only has 4 frames I have to set it to 5, so that it can pick 0, 1, 2, 3 and 4.

    LE: I'm just now noticing your second question, yes I'd like to pick all family members and all frames in the end. But without too much repetition, that's why I worded it like that.

    I edited my first post and reworded it to try and make it more clear and added a short example too of how it would work.

  • Ahhh, now I see, it's because of the "". I thought I had entered a variable there. K, thank you for clearing that up.

  • Hello World,

    As some of you may know(for example if you remember the itunes random generation scandal) true randomness doesn't really sit well with people because, ironically, it's not quite as "random" as we expect it to be, things repeat quite often.

    And after a few tests it seems it doesn't sit well with my game eighter, so I need your help to create some pseudorandomness.

    Ok, check the screenshot below.

    In event nr. 4 you can see how I currently try to randomize the sprites that appear.

    Could you guys please show me how the code would be if I wanted to do the following:

    • on first created pick a random member of the family(as I understand it, it does this by default on created since it's a family), then pick a random frame of that member;
    • on next created pick a random member of the family except the member that was previously picked, then pick a random frame of that member except the frame number that was previously picked;
    • on next created pick a random member of the family except the members that where previously picked, then pick a random frame of that member except the frame numbers that where previously picked;
    • after all family members have been picked reset them and the frame numbers(but keep track/remove the frames that where picked in each of them) then start picking family members again respecting the rules above;
    • after all combinations of family members and frames have been picked restart the entire process(so here you would reset the family members, the frame numbers and the frames each one has available for picking).

    Example:

    We have this family:

    • fam.member1 with frames 0, 1, 2, 3
    • fam.member2 with frames 0, 1
    • fam.member3 with frames 0, 1, 2, 3, 4, 5

    Then we start the process and they are randomly picked(spawned) as follows:

    fam.member3 frame 3

    fam.member1 frame 1

    fam.member2 frame 1 skipped as 1 was already chosen during this phase

    fam.member2 frame 0

    First batch done, this is what we have left for the next batch:

    • fam.member1 with frames 0, 2, 3
    • fam.member2 with frames 1
    • fam.member3 with frames 0, 1, 2, 4, 5

    Start picking again:

    fam.member2 frame 0 skipped, while the number 0 is available to be picked in this batch, that family member no longer has that particular frame available

    fam.member2 frame 1

    fam.member1 frame 3

    fam.member3 frame 5

    Now we are left with:

    • fam.member1 with frames 0, 2
    • fam.member3 with frames 0, 1, 2, 4

    And so on. Notice how the frame number that gets picked never repeats itself during a pick phase and it resets between phases, but we keep track and remove the frames that where picked of each individual member between phases, we only make these frames available again after the entire process has finished.

    A couple of important things/problems to keep in mind:

    • I tried both floor(random(8)) and random(0,8) and I didn't notice any difference, so use which ever one you think is best
    • the family members don't all have the same number of frames, some have more frames some have less. That's why it's important to keep track the of the frame numbers that where picked for each family member itself.
    • I don't know if it matters or not, but in event nr. 3 I show you how I spawn the monsters. I'd like to keep that part if possible.

    If you need anymore info let me know.

    Thank you!

  • I guess you'd want:

    Pick MonstersNoSigns where MonstersNoSigns.JustSpawned = 0

    Well that's exactly what I tried to do by using that "pick by comparison"... Compare if that variable is equal to 0 and pick only those for which that is true. But you just said that it can never be 0 LittleStain , what am I missing....?

    And as for "compare instance variable" I tried it, but it's all buggy, it skips a row, overlaps the sprites, etc.

    LE: Nevermind, I manage to get it done by using "pick all" and "compare instance variable" combined. I still don't really get why pick by comparison didn't work, but anyway, it's done. Thank you.

  • I see, I think... Could you please show me how you would use pick by comparison correctly in that situation LittleStain ?

  • Yes, it is a instance variable of monsters. But if that comparison is never true then how come the other parts of the event work as intended?

    First thing I tried is "compare instance variable" but that doesn't work, it's very buggy...

    LE: And I just tried changing the numbers from 0 to 1 and 2, if I do that nothing happens anymore at all... so what gives? I'm very confused...

  • Hello World,

    Check the event below please, everything seems to work fine except set size, the size never changes. For some reason C2 just ignores that part of the event, why?

    Thank you.

  • No, I haven't tried that yet saf . I'll try it when I get closer to releasing my next game. Thanks for the advice.

VIKINGS's avatar

VIKINGS

Member since 13 Feb, 2014

None one is following VIKINGS yet!

Trophy Case

  • 10-Year Club
  • Email Verified

Progress

11/44
How to earn trophies