[Squeakland] missing from etoys?

Bert Freudenberg bert at freudenbergs.de
Sun Oct 28 01:52:21 PDT 2007


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 <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
>
> _______________________________________________
> Squeakland mailing list
> Squeakland at squeakland.org
> http://squeakland.org/mailman/listinfo/squeakland




More information about the Squeakland mailing list