Move sprite to a new position?

Get help using Construct 2

Post » Thu Apr 27, 2017 1:39 am

I was originally using the vector x behavior, but the problem I ran in to was that it would only move a small way back. I thought this was because the vector x is capped at the movement speed. When I tried to increase the movement speed, obviously the character moved too quickly.

I think I read elsewhere on the forum that it would be advisable to use lerp to get around this. Do you think there's a better way?
B
5
S
1
G
3
Posts: 24
Reputation: 1,873

Post » Thu Apr 27, 2017 2:21 am

Okay, so I got it - thank you oosyrag. I set a global boolean called collision, then said:

On collision with enemy, set Target to Player.X-200 AND set Collision to True

Then...

If Collision is True, set Player X to lerp(Player.X, Target, 0.5) AND Wait .25 seconds, then set Collision to False

So I see what you mean about that not being optimal. If you think there's a better way, please let me know :)

But I THINK I finally understand lerp, which is a huge win for me.
B
5
S
1
G
3
Posts: 24
Reputation: 1,873

Post » Thu Apr 27, 2017 3:11 am

Oh right, I remember I was the one who mentioned the max speed thing haha. Here's how I would do it:

+ Player: On collision with Enemy
-> Player: Set Platform vector X to -1000
-> Player: Set Platform maximum speed to 1000
-> Player: Start ignoring Platform user input

+ System: Player.​Platform.​MaxSpeed > 330
-> Player: Set Platform maximum speed to max(​300​,​abs(​Player.​Platform.​VectorX)​)

+ System: Else
+ System: Trigger once
-> Player: Stop ignoring Platform user input
Mistakes were made.
B
54
S
28
G
115
Posts: 1,705
Reputation: 65,083

Previous

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 27 guests