How to give the player gravity without platform behaviour?

0 favourites
  • 4 posts
From the Asset Store
Players follower. use it for anything which follows the player
  • I am working on an endless runner, everything (except the player) moves from right to left. The player needs to be able to have gravity, so he can fall into holes. But adding the platform behaviour messes with the player position, when all I really need is gravity (and no movement whatsoever).

    Any other way of achieving that? Disabling platform behaviour and enabling it whenever the player is supposed to fall is probably not a very smart solution.

  • The easiest way is to add Bullet behavior, and set angle of motion to 90 degrees. It will constantly pull the player down. But it may interfere with other events in your game, so you might need to make some changes.

    Or simply set player Y to (self.y+100*dt) on every tick, where 100 is gravity speed.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you, will try that!

    Edit: It seems to me that without the platform or physics behaviour, the player will always float through the (solid) ground. The bullet behaviour can only be set to 'bounce off' (otherwise will penetrate solids), whereas the 'set y' action will make the player go through the solid as well.

    I am right now having a close look at the tutorial below, which apparently solved the issue I'm having by adding platform behaviour, disabling input and simulated walking. Not sure yet how the simulated walking will work with everything scrolling to the left.

    youtube.com/watch

  • If you only need gravity, then platform behavior may be an overkill. You can control collisions with the ground with events. Say, when object is overlapping ground, set bullet behavior disabled.

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