How do I create a mechanic exactly like sonic when he loses his rings?

0 favourites
  • 12 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • Hey guys, I'm trying to recreate a sonic game, but I'm stuck on the part that I get hit and drop all my rings. I made the ring dropping, bouncing and everything, my problem is to drop the exact amount of rings that I had before I got hit, like a for or repeat loop. How can I do it?

    Tagged:

  • I thought they all spawned at the same time on sonic games? So if rings a global variable, you just create that number of rings. If you are doing it one at a time I guess you can create a ring as you subtract 1 from rings variable until rings variable is 0.

  • Doing it one at a time would not look like they dropped all at the same time, they would begin to drop every tick. How would I compare the variable and spawn a certain number of them at once? Like "Spawn X (number of rings) objects"?

  • The only way I can think of if like "if 40 rings" followed by 40 spawn action lines, and doing that for 39, 38 and all number of rings possible, which I don't think it's fine.

  • Use the dedicated loop event "Repeat" with a single spawn action.

    + System: Repeat 40 times

    -> Sprite: Spawn Ring on layer 0 (image point 0)

  • That would also spawn of per tick. Every tick it would spawn one until the repeat count is reached. Really stuck on this one, seems complex.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Should be easy peasy with a While loop! When Sonic gets hit, do this:

    WHILE "ringsVariable" > 0 ------------- Spawn 1 Ring, Subtract 1 from "ringsVariable"

    This will all take place in 1 tick and so the player will see 40 rings appear and the ring counter change to 0.

  • That worked! Thanks a lot

  • That's what I suggested above, you don't need the while. Or use the repeat Kyatric suggested. Not sure why OP has got a problem with every tick.

  • No, your solution will add 1 ring every tick, which is what OP doesn't want. Making it a While loop will make all 40 rings appear in 1 tick. Otherwise, if the user has 90 rings it might take 1.5 seconds to drop them all at 60fps!

  • The event using the repeat condition is obviously not to be used as a top event that would indeed happened every tick, but to be used as a sub-event to the event that handles the collision with the main character.

    When asking for help, do always provide a capx of your project to prevent this kind of misunderstanding.

    The solution to the asked question has already been given in three different implementation ways nonetheless.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)