How do I make the platformer player "fake" physics?

0 favourites
  • 9 posts
From the Asset Store
Players follower. use it for anything which follows the player
  • My player character is a ball sprite. Is there a way to use the platformer plugin to make the ball behave like it is a physics object? The example I would give is, when the player ball falls onto an angled surface, or moves left and right, could it interact with the surface it is on like a physics "ball" by using the platformer behavior- making the ball spin or roll as it would if it were a physics object? Any help would be greatly appreciated. My game is getting somewhat bloated trying to use full physics for surfaces, obstacles and player.

  • So yes you could. However, it would be a huge undertaking and as it would be done in C2 it would be even more bloated.

  • So yes you could. However, it would be a huge undertaking and as it would be done in C2 it would be even more bloated.

    I guess that is the short answer?

  • Can't you just use vector x when ball is on floor when the solid (floor) it is on top of's angle is not = 0 ?

    As for the spinning animation, you should put your axis in the middle of the ball and just rotate your ball's angle (again when the floor's angle is not zero and ball is on floor).

    you might need to use some instance variables to set if going left or right (or just check the angle of the floor)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I know that MMF2 users have perfectly recreated the physics engine of sonic the hedgehog in their engine. Presumably people have done similarly for Construct2? Perhaps find one of those and then modify it to your liking.

  • I have edited this topic to remove the offline discussion.

    The main person have been contacted by PM on the best way for them to act.

    UnitDTH, your first post is not very clear, it would be better if you could post a capx and a clear explanation of what you are wanting to achieve, what you are currently achieving and how it defers from what you are expecting to do.

    This will allow us to give a better and more appropriate answer.

  • I have edited this topic to remove the offline discussion.

    The main person have been contacted by PM on the best way for them to act.

    UnitDTH, your first post is not very clear, it would be better if you could post a capx and a clear explanation of what you are wanting to achieve, what you are currently achieving and how it defers from what you are expecting to do.

    This will allow us to give a better and more appropriate answer.

    I will post a .capx later this evening, with a demo of what I've achieved with physics and a better description of what I would like to achieve using the platform behavior and why I would rather use the platform behavior.

    Thanks for the heads up Kyatric!

  • Why not use the physics behavior or this behavior?

    You can do it without the physics behaviors but you'll have to do some math.

    If ball is in the air then move it down.

    If the ball hits the ground then...

    1. find the angle of the ground.

    -- one way to do this is just have different sprites for different angles or you could even use the angle of the ground sprites.

    -- another way is to use two detector sprites. One a little to the left of the ball and another a little to the right. Then in a loop move each detector down till they hit the ground. Then just calculate the angle of the left detector to the right.

    2. Move and roll the ball down the slope. This is where the math comes in.

    -- the simplest way is of course to just use the move at angle action.

    -- the amount to rotate the ball can be calculated with distance_moved/ball_radius*180/pi. And make it rotate counter clockwise if the slope is to the left (or the angle is from 0 to -90 degrees.).

    That will give roughly ball motion. It can be improved instead by giving velocity and angular_velocity to give the ball momentum and calculating the accelerations on a slope for the angular_velocity. So basically the better you want it to look the more physics equations you need to use, which is something those behaviors already do for you. But it never hurts to learn how things work.

  • Why not use the physics behavior or this behavior?

    You can do it without the physics behaviors but you'll have to do some math.

    If ball is in the air then move it down.

    If the ball hits the ground then...

    1. find the angle of the ground.

    -- one way to do this is just have different sprites for different angles or you could even use the angle of the ground sprites.

    -- another way is to use two detector sprites. One a little to the left of the ball and another a little to the right. Then in a loop move each detector down till they hit the ground. Then just calculate the angle of the left detector to the right.

    2. Move and roll the ball down the slope. This is where the math comes in.

    -- the simplest way is of course to just use the move at angle action.

    -- the amount to rotate the ball can be calculated with distance_moved/ball_radius*180/pi. And make it rotate counter clockwise if the slope is to the left (or the angle is from 0 to -90 degrees.).

    That will give roughly ball motion. It can be improved instead by giving velocity and angular_velocity to give the ball momentum and calculating the accelerations on a slope for the angular_velocity. So basically the better you want it to look the more physics equations you need to use, which is something those behaviors already do for you. But it never hurts to learn how things work.

    Thank you R0j0Hound! I will try to make something like that up in a test file. Sorry I haven't uploaded an example. the game I'm currently making is for Wii U, so I have to make a C2 build without the Wii U Plugin and removing the plugin seems to be a hindrance for me at the moment.

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