Newbie Questions

Lic. Edgar J. De Cleene edgardec2001 at yahoo.com.ar
Fri Jul 4 13:34:19 UTC 2003


On 04/07/03 09:46, "Jeff Longland" <jlonglan at uwo.ca> wrote:

> I'm working on
> creating an object (a snake) that will travel along the edge of a rectangle
> while leaving a trail.  As the snake works around the rectangle and comes
> back to its starting point, the snake will view the existing trail as the
> new wall - making smaller and smaller rectangles, until the snake has
> covered the surface area of the rectangle.
Welcome again, this time to learn to How to build a Game.
In Squeak , you have too many alternatives,
I give you some morphics how to, another member could say about e-toys way
(or sripting)
File in the atacched in Squeak.
Open a Workspace.
Type my mySnake _ SnakeMorph new.

You see a blue rectangle travelling until right edge of screen. (not tailing
for now).
If need more and like railroading, I can send my unfinished SqueakRailRoad
and you could have one HO scale railroad layout building set .

Cheers.
edgar

-------------- next part --------------
Morph subclass: #SnakeMorph
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'SnakeGame'!

!SnakeMorph methodsFor: 'stepping and presenter' stamp: 'edc 7/4/2003 10:18'!
step
self move! !

!SnakeMorph methodsFor: 'stepping and presenter' stamp: 'edc 7/4/2003 10:12'!
stepTime
"response changes are each second"
^ 1000! !


!SnakeMorph methodsFor: 'creation' stamp: 'edc 7/4/2003 10:10'!
initialize
	super initialize.
	self openInWorld! !


!SnakeMorph methodsFor: 'miscellaneous' stamp: 'edc 7/4/2003 10:27'!
move
	| delta p |
	delta _ 10 @ 0.
(ActiveWorld bounds containsRect: self bounds) ifTrue: [
	p _ self referencePosition + delta.
	self referencePosition: p]! !


More information about the Squeak-dev mailing list