Maze

1,634 views
Skip to first unread message
Assigned to scottfr...@gmail.com by taifu...@gmail.com

ezio...@gmail.com

unread,
Feb 25, 2014, 9:13:35 AM2/25/14
to mitappinv...@googlegroups.com
Hi guys,

I am currently trying to make a maze game on App Inventor 2 but I could not find any hints on how to do so. I have created some images and drawn mazes within them but I have no idea how can I set up particular color to be the ball's path and whenever it touches the wall it would reset.

I was just thinking, is there a way to add a picture maze in to the canvas and set the walls on an image or is there any other way on how to creating wall within the walls and it would become like a maze?

Taifun

unread,
Feb 25, 2014, 9:24:40 AM2/25/14
to mitappinv...@googlegroups.com, ezio...@gmail.com
probably one of Scott's examples can help?
Taifun

Trying to push the limits of App Inventor! Snippets and Tutorials from Pura Vida Apps by Taifun.         

ezio...@gmail.com

unread,
Feb 25, 2014, 9:54:34 AM2/25/14
to mitappinv...@googlegroups.com, ezio...@gmail.com
There is a maze maker, but it's an actual app, I can't create a maze and then add to my project and I surely think that I can't put that maze on images that i want to use for my app.

The only thing I want to know if I can make a path for a ball like a small labyrinth with walls and set those walls to reset if touched. Is there any way to add walls that inventor would recognize and the ball could follow them?

Scott Ferguson

unread,
Feb 27, 2014, 8:29:19 AM2/27/14
to mitappinv...@googlegroups.com, ezio...@gmail.com
Once the maze is created the color of the walls can be 'sensed' with the Canvas GetBackgroundPixelColor (ignores colors on sprites) or GetPixelColor (includes sprite colors).
Suppose the ball is heading east (x=240) and has a radius of 5. Your blocks can if the color at x=250 is the wall color, then do something.
Normally the blocks would be inside a Clock Timer block which would continuously test the color under the specified x,y location.
An extension of this would be testing all four sides of the ball to see if it is touching a wall. That might be useful if your app uses the tilt sensor to move the ball.
---
Scott 
Reply all
Reply to author
Forward
0 new messages