constant y-movement for player on sphere

0 favourites
  • 3 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • hello,

    Mario Galaxy has mario running on spheres/planets.

    I wanted to try this in 2D and tried some tutorials.

    The player uses platform behaviour and the sphere uses behaviour "solid", but that makes it not perfectly round.

    So the player-sprite moves a bit up and down, while walking around the sphere. (because the sphere sprite is perfectly round, but the solid behaviour uses the collision polygon - which is not perfectly round. The player walks on the slopes of the collision polygon)

    If this was a stairway, I could make an invisible ramp, but this is a circle and that makes it difficult for me to think of solutions.

    I hope I could make my question clear. If not, I will make a gif.

    What is your suggestion to make it appear the player walks on a perfectly round sphere, instead of the collision polygon where it is actually walking on?

  • If you don't use solid you can make the player stand perfectly on the sphere like so:

    every tick

    --- player: set angle toward earth.x, earth.y

    --- player: rotate 90 degrees counterclockwise

    distance(earth.x,earth.y,player.x,player.y) <= radius

    --- player: set position to earth

    --- player: move radius pixels at angle player.angle+90

    Making the platform behavior happy is another issue. Since there is no solid, the platform behavior doesn't know when it's on the ground. You can do the logic manually though. When the second event runs, the player is on the earth, so you can add a sub-event to check for the jump key is pressed and then simulate a jump.

    Walking could be done similarly, but for smoothest motion I suppose you can be more clever.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks R0J0hound.

    Although I could not get your example to work, I understand that it makes the player go in a circular motion.

    So I used the logic of to make the player move around the earth.

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