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

Get help using Construct 2

Post » Sat Jan 03, 2015 7:08 pm

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.
B
7
S
1
Posts: 26
Reputation: 497

Post » Sun Jan 04, 2015 8:45 pm

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.
ImageImageImageImageImage
B
19
S
5
G
1
Posts: 614
Reputation: 2,542

Post » Mon Jan 05, 2015 2:30 am

TheWyrm wrote: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? ;)
B
7
S
1
Posts: 26
Reputation: 497

Post » Mon Jan 05, 2015 2:33 am

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)
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Mon Jan 05, 2015 9:32 am

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.
B
6
S
1
G
1
Posts: 97
Reputation: 914

Post » Mon Jan 05, 2015 6:33 pm

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.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
296
S
119
G
96
Posts: 7,328
Reputation: 71,298

Post » Mon Jan 05, 2015 9:05 pm

Kyatric wrote: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! :D
B
7
S
1
Posts: 26
Reputation: 497

Post » Mon Jan 05, 2015 9:29 pm

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.
B
94
S
33
G
118
Posts: 5,394
Reputation: 75,849

Post » Sat Jan 10, 2015 12:59 am

R0J0hound wrote: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.
B
7
S
1
Posts: 26
Reputation: 497


Return to How do I....?

Who is online

Users browsing this forum: matriax and 7 guests