[Squeakland] missing from etoys?

Dreyfuss Pierre-André (EDU) pierre-andre.dreyfuss at edu.ge.ch
Fri Nov 2 03:47:30 PDT 2007


HI,

Nice, You have found the rule that with Etoys we have to see What an object knows and can do for itself to put the scripts in the right  objects.
So the bullet knows when it reaches the barrier and can delete itself.

I found about the same solution trying to solve this project.

To let the gun move in the same direction after shooting, I have tested the heading value. If it is -90 I put <left> in the input buffer, if it is 90 I put <right>

With the test on the key pressed, I have added to set heading to 0 if the <down> is pressed, This will enable  to put <down> again after shooting if heading is 0. This way the gun remains still if the down key was pressed before shooting and go no moving to right or left.

Best regards.

 

-------- Message d'origine--------
De: squeakland-bounces at squeakland.org de la part de Bill Kerr
Date: ven. 02/11/2007 07:25
À: Bert Freudenberg
Cc: Tony Forster; squeakland at squeakland.org; Paul T
Objet : Re: [Squeakland] missing from etoys?
 
http://billkerr2.blogspot.com/2007/11/how-to-make-space-invaders-in-etoys.html

I've written it up step by step, with screenshots on my blog

cheers,
- Bill

On Nov 2, 2007 11:20 AM, Bill Kerr <billkerr at gmail.com> wrote:

> thanks Bert, you are correct, I've got it working now
>
> - Bill
>
>
> On Nov 1, 2007 9:57 PM, Bert Freudenberg <bert at freudenbergs.de> wrote:
>
> > Hmm, why don't you let the bullet clean up itself when it reaches the
> > edge of the screen?
> >
> > "managing multiple bullets" seems the wrong approach to me, fire-and-
> > forget would manage itself.
> >
> > - Bert -
> >
> > On Nov 1, 2007, at 4:29 , Bill Kerr wrote:
> >
> > > 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/etoy/shooter1.010.pr
> > >
> > > prime
> > >     self getNewBullet setHeading: 0.0.
> > >     self getNewBullet setY: self getY + 10.
> > >     self getNewBullet setX: self getX
> > >
> > >
> > > shoot
> > >     World2 getLastKeystroke = '<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
> > >
> > >
> > > _______________________________________________
> > > Squeakland mailing list
> > > Squeakland at squeakland.org
> > > http://squeakland.org/mailman/listinfo/squeakland
> >
> >
> >




More information about the Squeakland mailing list