Arrow Keys to control movement of a Morph

Milan Zimmermann milan.zimmermann at sympatico.ca
Wed Jul 7 04:02:34 UTC 2004


Karl,

Using your changeset (thanks again) I am playing with moving a Morph, in eToys 
using: "MyEllips's's keyHit a", which I added in a script.

I do not know how to replace the "a" with another Character using "drag"  so I 
revert to textual form and have, as a first test, something like

arrowResponse
	(self wasCharacterHit: Character arrowLeft)
		ifTrue: [self forward: 5. ].
	(self wasCharacterHit: Character arrowRight)
		ifTrue: [self forward: -5].

And that works nicely.

Just for curiosity, is there some way to drag  Characters from somewhere in 
eToy's, something like a "Character table"

Thanks Milan
On July 4, 2004 02:40 am, Karl Ramberg wrote:
> I think Squeak central is working on better soulution, but this is quite
> good.
>
> Karl
>
> Milan Zimmermann wrote:
> > Hello,
> >
> > For a simple game I'd like to use up/down/left/right keys to control
> > movement of a Morph, preferably in eToys  (did not find it though). I
> > tried to find any code that would help me, but no luck. Would someone
> > have a suggestion on how to do something like this: Make Morph listen to
> > the Up/Down/Left/Righ arrow movements (and change it's direction of
> > movement based on that)
> >
> > Thanks




More information about the Squeak-dev mailing list