Platform Gravitate Toward Object

Get help using Construct 2

Post » Sun Sep 18, 2011 3:03 am

I was wondering how to make a platform character gravitate toward a solid object, and allow the character to jump between solid objects. If that isn't possible, I'd like to know how to make sideways gravity. Thanks!
B
13
S
2
G
1
Posts: 14
Reputation: 1,111

Post » Sun Sep 18, 2011 4:23 am

Maybe try picking the nearest solid object, and calculating the angle difference between it and your character object (eg: GravAngle).

Then move your object at your chosen speed (eg: GravSpeed) towards this angle:

X = Character.X + GravSpeed * Cos(GravAngle - 90)
Y = Character.Y + GravSpeed * Sin(GravAngle - 90)

Might need some tinkering for calculating the angle difference, and whether or not the - 90 is required though (as this is used to move at the angle an object is facing).
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009


Return to How do I....?

Who is online

Users browsing this forum: Bad Wolf, davides, NRABrazil, Vallar, WhosWho and 26 guests