Problem with a simple platformer system

0 favourites
  • 5 posts
From the Asset Store
10 Retro songs ideal for platformers or farming games
  • Hello guys! I'm learning to use Construct in the last month and I'm very excited about the engine and the community.

    In the last few days, I came across a problem that I can't solve:

    My game is a platform, and I have a simple system where the player "flies" for a few seconds while the SHIFT key is pressed.

    However, it is a "special power", and the player needs to collect an item (item> 0) to do this.

    The problem: when you use "fly", you lose "1 item". But when you lose "1 item", you are left with 0 item. And if you have 0 items, the "fly" will not work.

    Summary: "flying" works for 1 tick, the player loses "item" and "flying" stops working, because there is no more "item" to make it work.

    The player should lose the "Item" only when he is on the ground, or when the SHIFT is released, but I was unable to make it happen. Someone to help me solve this stupid question?

    Thank you very much <3

  • I suggest using Timer behavior here. When player uses that special item, subtract 1 from Item, set gravity to 0 and start a Timer "fly".

    In 'On Timer "fly"' event restore the gravity.

  • Thanks for the answer!

    Unfortunately, it didn't work. The problem remains the same: when I subtract 1 item, the event simply stops, because there is no more "item" to make it work. When I disable "subtract 1 item", it works perfectly.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here is a demo:

    dropbox.com/s/e43k3eh6kz98x5j/Fly.capx

  • Fantastic! Thank you!! Solved

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