missing from etoys?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

missing from etoys?

Bill Kerr
I can't see any capability for keyboard commands
(important requirement for serious game making)

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


_______________________________________________
Squeakland mailing list
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: missing from etoys?

Bert Freudenberg
On Oct 27, 2007, at 15:29 , Bill Kerr wrote:

> I can't see any capability for keyboard commands
> (important requirement for serious game making)

In the World's viewer you can find the "last keystroke" tile.

- Bert -



_______________________________________________
Squeakland mailing list
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: missing from etoys?

Karl-19
In reply to this post by Bill Kerr
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

_______________________________________________
Squeakland mailing list
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: missing from etoys?

Richard Karpinski-2
In reply to this post by Bill Kerr

On 2007, Oct 27, , at  6:29:58 PDT, "Bill Kerr" <[hidden email]>  
wrote:

But there was no content in the message as I got it.

Is that to imply that nothing is missing from etoys?

Dick



_______________________________________________
Squeakland mailing list
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: missing from etoys?

Bill Kerr
In reply to this post by Karl-19
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 = '<right>' ~~ false
        ifTrue: [self setHeading: 90.
            self forward: 5].
    World1 getLastKeystroke = '<left>' ~~ false
        ifTrue: [self setHeading: -90.0.
            self forward: 5]

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

shoot
    World1 getLastKeystroke = ' ' ~~ 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 <[hidden email]> 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


_______________________________________________
Squeakland mailing list
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: missing from etoys?

Bert Freudenberg
Hi Bill,

the Etoys version wouldn't actually be too different from the Game  
Maker one. You wrote:

> start moving in directions 000000010 with speed set to 10
> play sound sndShot

"start moving" is not the same as "move" obviously. So make a  
"moving" script for the bullet that ticks and moves it one step each  
time, and on space key press "start moving", that is, call "bullet  
startScript: #moving" from the "scripting" category.

An alternative to this would be introducing a "moving" variable that  
would be set to true when the space key is hit, and testing this in  
each step to move the bullet.

- Bert -

On Oct 28, 2007, at 4:06 , Bill Kerr wrote:

> 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 = '<right>' ~~ false
>         ifTrue: [self setHeading: 90.
>             self forward: 5].
>     World1 getLastKeystroke = '<left>' ~~ false
>         ifTrue: [self setHeading: -90.0.
>             self forward: 5]
>
> prime
>     World1 getLastKeystroke = 'z' ~~ false
>         ifTrue: [Bullet setY: self getY.
>             Bullet setX: self getX]
>
> shoot
>     World1 getLastKeystroke = ' ' ~~ 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 <[hidden email]> 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
>
> _______________________________________________
> Squeakland mailing list
> [hidden email]
> http://squeakland.org/mailman/listinfo/squeakland


_______________________________________________
Squeakland mailing list
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: missing from etoys?

Bill Kerr
A friend sent me this useful information:

have a look at http://wiki.squeak.org/squeak/488
(Keyboard support in EToys)
in particular
http://bike-nomad.com/squeak/DriveUsingKeyboard.002.pr
although that project doesnt seem to work properly it shows
how to structure the    world   keywatcher  -  script

-------------------------------------------------------------------------
keyWatcher
        self getLastKeystroke = '<left>' ~~ false
                ifTrue: [Car1 doScript: #turnLeft]
                ifFalse: [self getLastKeystroke = '<right>' ~~ false
                                ifTrue: [Car1 doScript: #turnRight]
                                ifFalse: [self getLastKeystroke = '<up>' ~~ false
                                                ifTrue: [Car1 doScript: #accelerate]
                                                ifFalse: [self getLastKeystroke = '<down>' ~~ false
                                                                ifTrue: [Car1 doScript: #brake]]]]


On 10/28/07, Bert Freudenberg <[hidden email]> wrote:
Hi Bill,

the Etoys version wouldn't actually be too different from the Game
Maker one. You wrote:

> start moving in directions 000000010 with speed set to 10
> play sound sndShot

"start moving" is not the same as "move" obviously. So make a
"moving" script for the bullet that ticks and moves it one step each
time, and on space key press "start moving", that is, call "bullet
startScript: #moving" from the "scripting" category.

An alternative to this would be introducing a "moving" variable that
would be set to true when the space key is hit, and testing this in
each step to move the bullet.

- Bert -

On Oct 28, 2007, at 4:06 , Bill Kerr wrote:

> 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 = '<right>' ~~ false
>         ifTrue: [self setHeading: 90.
>             self forward: 5].

>     World1 getLastKeystroke = '<left>' ~~ false
>         ifTrue: [self setHeading: -90.0.
>             self forward: 5]
>
> prime
>     World1 getLastKeystroke = 'z' ~~ false
>         ifTrue: [Bullet setY: self getY.
>             Bullet setX: self getX]
>
> shoot
>     World1 getLastKeystroke = ' ' ~~ 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 < [hidden email]> 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
>
> _______________________________________________
> Squeakland mailing list
> [hidden email]
> http://squeakland.org/mailman/listinfo/squeakland


_______________________________________________
Squeakland mailing list
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: missing from etoys?

Karl-19
In reply to this post by Bill Kerr
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
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: missing from etoys?

Bill Kerr
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 < [hidden email]> 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
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: missing from etoys?

Bert Freudenberg
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 < [hidden email]> 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
> [hidden email]
> http://squeakland.org/mailman/listinfo/squeakland



_______________________________________________
Squeakland mailing list
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: missing from etoys?

Bill Kerr
thanks Bert, you are correct, I've got it working now

- Bill

On Nov 1, 2007 9:57 PM, Bert Freudenberg <[hidden email]> 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 < [hidden email]> 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
> [hidden email]
> http://squeakland.org/mailman/listinfo/squeakland



_______________________________________________
Squeakland mailing list
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: missing from etoys?

Bill Kerr
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 <[hidden email]> wrote:
thanks Bert, you are correct, I've got it working now

- Bill


On Nov 1, 2007 9:57 PM, Bert Freudenberg <[hidden email]> 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 < [hidden email]> 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
> [hidden email]
> http://squeakland.org/mailman/listinfo/squeakland





_______________________________________________
Squeakland mailing list
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

RE : missing from etoys?

Dreyfuss Pierre-André (EDUM)

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: [hidden email] de la part de Bill Kerr
Date: ven. 02/11/2007 07:25
À: Bert Freudenberg
Cc: Tony Forster; [hidden email]; 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 <[hidden email]> wrote:

> thanks Bert, you are correct, I've got it working now
>
> - Bill
>
>
> On Nov 1, 2007 9:57 PM, Bert Freudenberg <[hidden email]> 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 < [hidden email]> 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
> > > [hidden email]
> > > http://squeakland.org/mailman/listinfo/squeakland
> >
> >
> >


_______________________________________________
Squeakland mailing list
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland