2016년 12월 29일 목요일

AppInventor Collision Detection


I'm making a maze game in Appinventor and what I need is for the sprite you move through the maze to stop moving once it touches another sprite, in this case a wall. Does anyone know how to do this? 

--
please first check these maze threads and in case these do not help, then ask again

-- 
Another possibility is to check if any of the pixels just outside of the boundary of the sprite is the wall color, if so, then you are touching one or more walls.
For that you would likely use the canvas GetBackgroundPixelColor method.

-- 
Thanks, I'll try that. Also, I'm trying to get my character to keep moving until the button is released, instead of just moving a bit every time I press the button. Any sugestions?

-- 
Set the character sprite's initial Speed to 0.
Set the character sprite's initial Heading to the direction you want it to move.


Inside the button TouchDown event block, set the character sprite's Speed property to a non-zero positive value. 

Inside the button TouchUp even block, set the character sprite's Speed to 0.

-- 
Thank you so much! That is exactly what I needed.

-- 
One last question, how do I use this block? I don't know what I'm supposed to attach it to, and what to do with it afterwards.

-- 


댓글 없음:

댓글 쓰기