How do I Flip Players Behaviour?

  • Okay so this part of the game has stopped me in my tracks. Let me explain what the game is............

    The game is a play who is stood on a moving platform. The platform is thin (30pixels) and is positioned in the centre of the screen. Therefore both the top and bottom of the platform are visible.

    There are enemies spawning from the right heading towards the player on the left. The player has to jump over these enemies as they come towards him.

    There is a flip button which allows the the player to flip to the underside of the platform avoiding the enemies on the top. The bottom platform also has enemies coming towards him.

    THE PROBLEM: The problem i am having is that when a player has a platform behaviour he continues to fall until he lands on a solid object. How do i make it so that when the player flips to the underside of the platform he doesn't fall and that when he jumps it will be -100 in strength for example and he will essentially jump DOWN as opposed to UP???

    Sorry it was so drawn out. I have tried attaching an image example of what i mean to make it more understanding

  • Set a negative value to Gravity in Platform Behavior.

  • Yeah i managed to do that but how do i set the position of the player to under the platform without the player falling due to its 'platform' behaviour, and repeat the flipping process every time the ''flip'' button is pressed????

  • If the platform is fixed, just Set Y.

  • I know I probably sound stupid haha but what do you mean? How should I code it?

  • You won't be using the platform behavior for the flip. Disable it and reenable once the player is flipped. You can create smooth motion using this: https://www.scirra.com/tutorials/378/cr ... -with-lerp. You might also do some funny things with the height of the player's sprite to make it look better. The position you are trying to move the player toward is Platform.Y - <Player's Height>. You probably don't want to change the player's X.

    If you just want to move the player without getting fancy, sprite has a Set Position action.

  • Do you want to do this?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • bladedpenguin I was confused by the Lerp thing. I couldn't find the capx to download?

    EstudioCelula3 is it possible to screenshot the event page? I have an older version and had a few problems downloading the newer version.

  • Hmm I PM'd the author of the tut. Hopefully he responds and updates his links.

    You should still be able to move the Player with Set Position, it'll just be instant instead of smooth.

  • thanks so much. Yeah instant is fine

  • EstudioCelula3 Brilliant just like that . I just need to work on the jump now. Thanks so much both of you.

    I'll post the game in the finished project section of scirra forums when its done. Hopefully less than a week

  • EstudioCelula3 It works perfectly thanks so much!

    Is there a way i can make the actual player flip so that his face turns upside down as well as being flipped?

  • EstudioCelula3 It works perfectly thanks so much!

    Is there a way i can make the actual player flip so that his face turns upside down as well as being flipped?

    Try Set angle and Set mirror

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