How do I limit my X movement

Get help using Construct 2

Post » Tue Sep 23, 2014 1:47 pm

Hi all,

i want to limit my character from moving far away from a scrolling object {which the character is attched to}. How can i write the expression - if the X is bigger than a number, then ignore the input from the "Right/left button". I cant figure the first part- how to get the X coordinates of an object + the distance i need for reaching the limit.

thanks!
B
8
S
4
G
1
Posts: 191
Reputation: 1,873

Post » Tue Sep 23, 2014 1:55 pm

Something like this would work

x > object.x+200

You could also use the clamp expression

clamp(x, lower, upper)

so something like clamp(player.x,object.x-200,object.x+200)
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: David181, jorgmaquoi, SignalOne and 23 guests