Understanding SnakeGame

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Understanding SnakeGame

Filip Malczak
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.

--
Greeting
Filip
GG: 2486889
mail: [hidden email]

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Understanding SnakeGame

Randal L. Schwartz
>>>>> "Filip" == Filip Malczak <[hidden email]> 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.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[hidden email]> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners