So we have a SnakeGame (you can get it with Wolrd->open-SqueakMap Package Loader). I wanted to look at its code to uderstand it, and learn how to write in Squeak (not syntax, but algorithms, etc). And so I have this problem: I know how to make the snake go, but where and how do I create gameboard? And 'New Game' and 'Quit' buttons? If anyone could explain me EXACTLY step by step how is the game going - I'd be very pleased.
"Filip" == Filip Malczak filet00@gmail.com writes:
Filip> So we have a SnakeGame (you can get it with Wolrd->open-SqueakMap Package Filip> Loader). I wanted to look at its code to uderstand it, and learn how to Filip> write in Squeak (not syntax, but algorithms, etc). And so I have this Filip> problem: Filip> I know how to make the snake go, but where and how do I create gameboard? Filip> And 'New Game' and 'Quit' buttons? Filip> If anyone could explain me EXACTLY step by step how is the game going - I'd Filip> be very pleased.
first, load the package from squeakmap.
then, make a SnakeGame Morph (world menu, new morph, from alphabetic list, s, snakegame)
Once you have a game morph, bring up halos on it (command-click on mac), and look for the tool icon on the right. select "browse morph's class".
From there, you can see in the #initialize code that it eventually
calls #makeControlPanel, which makes those buttons. It also starts stepping, and in #step are the "live" actions. You might also want to browse the "SnakeMorph" class to see how the board itself works.
Hope that helps.
beginners@lists.squeakfoundation.org