How to check if a touch is in the box?
digleto
Member Posts: 76
I have a ball and a box. I move the ball by touch. I only want to be able to move the ball if I touch inside the box. I cant seem to figure out how to check if the touch is inside the box or not... help?
Thanks in advance
-Digleto
Thanks in advance
-Digleto
Comments
If touch inside
change attribute game.whatever to 1
and on the ball:
if attribute game.whatever = 1
AND
if touch
do whatever you want
add to your rule, if touch inside.
you have a ton of touch rules: pressed, released, inside, outside
so to make sure you're only touching the ball when it's inside the box, create a global attribute called boxTouched or something.
then on the box, just like Hunn said, put:
if touch is pressed and touch is inside
change game.boxTouched to True
and on the ball:
if game.boxTouched is True
[put game logic here]
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left