You guys don't know what Galaga is? Shame... It's 2D by the way.
Well this would maybe work for a start...
load image "laser.bmp",1
`first load our laser image
laser = 1
sprite laser,300,500,1
`we will use the variable laser to reference our sprite
`which we will create originally at the coordinates 300, 500
`using our laser image, which is image 1
sync on:sync rate 80
`set manual sync on and set our frames per second to 80
do
sprite laser, sprite x(1), sprite y(1) - 10,1
`redraw this sprite every time during the loop
`only subtract 10 from the y coordinate every time
`to make it move up
if spacekey() = 0 then spaceready = 1
`if we are not pressing the space key
`then we will make the program remember
`that it is ready to be pressed again.
`This will make it so the laser will only
`be fired once when the space key is pressed
if spacekey() = 1 and spaceready = 1
`if you DO press the space key, we check
`that it is ready to be pressed again
sprite laser, 300,500, 1
`and then redraw this sprite,
`only at the bottom of the screen.
spaceready = 0
`set spaceready back to 0 so the program knows
`not to keep firing lasers over and over
`and wait until you let go again
endif
sync
loop
It is heavily commented to help you understand what's going on.
If you wanted to make a galaga style space shooter, you would need lots of other things such as making the ship move when you press buttons, making enemies move down, making it so that they die when hit by the laser, etc. But this should be a good start.
Anarchy Burger - hold the Government!