How do I make a player move to a exact position

Get help using Construct 2

Post » Mon Mar 07, 2016 10:02 am

How do I make a player move to a position i want (x,y) from any position with walking animations and footsteps

I want to be able to set a position the player walks toward to it and stops at the set position
B
4
Posts: 10
Reputation: 222

Post » Mon Mar 07, 2016 10:27 am

There are many ways

make a sprite on the top left corner

Events
system > every tick | objSprite > set position to > X= lerp (Self.X, 500, dt) Y= lerp (Self.Y, 500, dt)

this makes a transition from the current X and Y position to XY500 and the speed it uses is delta time
I used delta time, because it is framerate independent.

Here is the explanation from the manual
lerp(a, b, x) Linear interpolation of a to b by x. Calculates a + x * (b - a).

for dt (delta time) http://www.scirra.com/tutorials/67/delt ... dependence

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707


Return to How do I....?

Who is online

Users browsing this forum: Lordshiva1948 and 9 guests