So I've recently started to make a little maze game in appinventor, basically you use your finger as a direction guide for the animation to move to the end of the maze. I like the concept, but the only problem is that when I run it on my companion, the thing just freezes and gives me the code error
"#null!" Is there something wrong with the code?
The thing is, I want (and need) these features in the game:
Touchscreen movement;
Stopwatch & timer;
Multiple mazes;
Detect whether touching wall, and rebound if that is true.
Thanks, but my major issue here is that the app just crashes immediately after I open it. I already have finished all the requirements listed, it's only that I do not understand what is wrong with my code. Sorry!
The problem for "t the app just crashes immediately after I open it" is probably your code in the Screen1.Initialize event handler. Look there for the bad code (possibly related to a Clock setting).
Loops are not useful for things that update the screen.
Instead, define 4 Clocks, for the 4 directions of movement, and have them all disabled until you start them moving the player, one step per Timer event.
Have each Clock Timer do the appropriate edge or barrier testing.
If the pixel scolor sensing approach doesn't work for you, there are alternative approaches based on a row and column framework, since your sample images are all built on a grid.
You could keep a row and column cell naming convention like one of
A1, B1,C1 reading cell names in the first row of a spreadsheet, or
'01,01', '01,02', '01,03' for numbered coordinate pairs for those cells.
A maze could be represented as where you would end up in you went in one four directions from a cell.
Four dictionaries (left, right, up, down) would be enough, with the key being the cell name and the value being where you would end up if you tried to go in that direction.
A wall would send you back to the originating cell.
A doorway would send you into the adjacent cell in that direction.
The 4 dictionaries could be fed into a drawing routine, to draw the walls.