Hi
I am making a game in which the sprite moves when the button is pressed. But I want it to not go beyond a certain coordinate.
I am attaching the code below
Pls suggest ways to rectify it.
Thank you
Where does "car" start ? (x,y)
At what value of x do you want to stop "car" ? (seems you want 2 options ??)
Often better to try using "<" or ">" instead of "="
You could put a small Ball at the target location, set the moving Sprite in motion towards the small Ball, and stop the Sprite then it collides with the Ball.
Sample:
@TIMAI2@ABG@SteveJG Thank you for your inputs.
So basically I have a track as the bg of my canvas and I don't want the car to move outside the track. And if touches the side edges of the track the car shouldn't move.
I found out the coordinate of X of the track and used that in the if condition. However, that doesn't seem to work.