Move object when close to another
cnmeyer1980
Member, PRO Posts: 211
Hi guys,
Just wondering if anyone can help me with a little bit of code.
Basically, I'm trying to work out the below.
I have a square as the main character that you control by pressing on screen.
There is a circle on screen that, if you're close to it and hold a move button, the circle moves a little.
If the square is under the circle it moves up, if its above the circle it moves down, if its to the left it moves right, and if its to the right it moves left.
Sooooooo, HUGE question, but does anyone know the logic for this?
As always, thank you for your continuing help.
Cheers
Chris
Just wondering if anyone can help me with a little bit of code.
Basically, I'm trying to work out the below.
I have a square as the main character that you control by pressing on screen.
There is a circle on screen that, if you're close to it and hold a move button, the circle moves a little.
If the square is under the circle it moves up, if its above the circle it moves down, if its to the left it moves right, and if its to the right it moves left.
Sooooooo, HUGE question, but does anyone know the logic for this?
As always, thank you for your continuing help.
Cheers
Chris
Comments
If not, you'll need to constrain some game attributes to the circle's position (assuming there's only one circle) and then use those attributes instead of the 300, etc.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User