[Squeakland] missing from etoys?

Bill Kerr billkerr at gmail.com
Wed Oct 31 20:29:51 PDT 2007


I've solved some of the problems but still have at least one big one

SUCCESS:
Can move and shoot at the same time
Can make a single sound when shooting
Can simulate a key press

PROBLEMS:
When I fire a second bullet the first bullet stops moving (main current
problem)
Can only create new bullets when an original bullet is on the screen (it
would be nice to create from scratch but I suppose I can live with that)

Each new bullet is automatically named bullet1, bullet2, etc
My script sets the timer running for a newBullet (Player variable) . So when
a second bullet is created then the first bullet stops.

Each new bullet has its own player with it's own timer. So, what's a good
way to manage firing multiple bullets and then tidying up as they reach the
top of the screen or hit a target (without deleting all the siblings?) I'm
finding that hard.

I've put my project here:
http://www.squeakland.org/project.jsp?http://www.users.on.net/~billkerr/eto=
y/shooter1.010.pr

prime
    self getNewBullet setHeading: 0.0.
    self getNewBullet setY: self getY + 10.
    self getNewBullet setX: self getX


shoot
    World2 getLastKeystroke =3D '<up>' ~~ false
        ifTrue: [self setNewBullet: Bullet1 getNewClone.
            self prime.
            Bullet1 beep: 'clink'.
            Bullet1 startScript: #move.
            World2 setLastKeystroke: '<down>']     "simulate keypress"

move
    Gun1 getNewBullet forward: 5


(I haven't included the code that moves the gun left and right)

I do have a delete siblings script which I use to tidy up but it's not
integrated:

deleteSiblings
    self tellAllSiblings: #delete

Some bits of Karl's tutorial are dated but it was very useful - thanks. I
had to go through and put newBullet in everywhere, it didn't work by just
replacing <gun prime> with <gun's new bullet prime>, which is what Karl's
tutorial seems to do. I had to replace each line of the <gun prime>
procedure code with <gun's new bullet prime>

At any rate, many thanks for the help

-- =

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



On Oct 29, 2007 7:06 AM, Karl <karl.ramberg at comhem.se> wrote:

> Bill Kerr wrote:
> >
> > I see making a shooter, eg. a space invaders simulation, as a nice
> > first game activity for children, one that many find highly motivating
> >
> I made a tutorial a long time ago about this.
> http://209.143.91.36/super/503
>
> I think there are some issues with the layout of images and the text.
> Also it does not use keyboard but the joystick morph.
>
> Karl
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://squeakland.org/pipermail/squeakland/attachments/20071101/a603e2=
4c/attachment.htm


More information about the Squeakland mailing list