[Squeakland] missing from etoys?

Bill Kerr billkerr at gmail.com
Sat Oct 27 20:06:38 PDT 2007


thanks bert, karl

but still can't get the functionality I want with only a global
lastKeyStroke

eg. to make a simple shooter
I have one script to move the shooter right and left - using right and left
keys
Another script to prime the bullet, so it starts in the same position as the
shooter - I have arbitarily used the z key for this
Another script to shoot the bullet - I have used space bar for this

But if I shoot the bullet and then move the shooter then the bullet suddenly
stops
And I want to make a sound once only when the bullet fires, can't see how to
do that because the script to fire the bullet has to tick continually

Converting my visual scripts to text:

move
    World1 getLastKeystroke =3D '<right>' ~~ false
        ifTrue: [self setHeading: 90.
            self forward: 5].
    World1 getLastKeystroke =3D '<left>' ~~ false
        ifTrue: [self setHeading: -90.0.
            self forward: 5]

prime
    World1 getLastKeystroke =3D 'z' ~~ false
        ifTrue: [Bullet setY: self getY.
            Bullet setX: self getX]

shoot
    World1 getLastKeystroke =3D ' ' ~~ false
        ifTrue: [self setHeading: 0.0.
            self forward: 10]


By comparison it's much easier using GameMaker, which has localised (to
objects) keyboard and keypress events and distinct movement and  speed
actions

Information about object: objBear

Keyboard Event for <Left> Key:
move relative to position (-4,0)

Keyboard Event for <Right> Key:
move relative to position (4,0)

Key Press Event for <Space> Key:
create instance of object objBullet at position (objBear.x,objBear.y)
______________________________________________________

Information about object: objBullet

Create Event:
start moving in directions 000000010 with speed set to 10
play sound sndShot; looping: false


I see making a shooter, eg. a space invaders simulation, as a nice first
game activity for children, one that many find highly motivating


-- =

Bill Kerr
http://billkerr2.blogspot.com/

On 10/28/07, karl <karl.ramberg at comhem.se> wrote:
>
> Bill Kerr wrote:
> > I can't see any capability for keyboard commands
> > (important requirement for serious game making)
> Key input is a property of the world. Make a viewer on the world and one
> of the categories has keyboard input.
>
> Karl
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://squeakland.org/pipermail/squeakland/attachments/20071028/9082cb=
49/attachment.htm


More information about the Squeakland mailing list