Hello there!
So, this is a problem I've run into before, but now I've run into it again! I'm just trying to finish one of my many "prototype" games that I have started in the past, but never fully finished, and it is a drawing game. My idea is that it would be very simple and it would almost be like an Etch-a-Sketch, but the screen clears when you crank it. I'm positive a game like this already exists, but I just wanted to finish this one because I had some pretty cool ideas to do other things with it. Also, I kind of would like to figure this problem out.
(As you can see in the above GIF, the game freezes when you try and crank.)
So here's the problem: I am trying to program a function where if you turn the crank, all tiles will revert to frame one. In the game, each tile in the room is an item, and when you collect it it goes to frame one, which is black. The idea is that all of those tiles should go back to white when you crank, but they don't. Instead, the entire game freezes.
In my current code I call a "reset" function from the crank
function in the player script.
on crank do
tell "tile" to
call "reset"
end
end
The "reset" function is stored inside of the tile:
on reset do
frame frameZero
end
That code should technically revert all of the tiles to frame 0. The error, I think, is that you can't call frame on all of the objects. The only solution I can think of is to make the player go to a different room really quick and then come back, so I can use an enter
function, but that would be really annoying.
So, if you read all that, thank you! And if you can figure out a solution, that would be great! If there isn't one, I guess I'll just have to settle for the enter
thing, I guess.