Here's an example.
rem ============================
rem SPRITE SHOOTING EXAMPLE CODE
rem ============================
rem Setup the game
sync on
sync rate 60
color backdrop 0
rem Make an image for the player. It's image 1
Create bitmap 1,10,10
for l =5 to 10
ink rgb(rnd(255),rnd(255),rnd(255)),0
line 0,l,10,l
next l
line 0,0,5,5
line 10,0,5,5
get image 1,0,0,10,10
delete bitmap 1
rem Make an image for the bullet. It's image 2.
Create bitmap 1,10,10
for l =1 to 10
ink rgb(rnd(255),155,0),0
line 0,l,10,l
next l
get image 2,0,0,10,10
delete bitmap 1
rem Make the player sprite
sprite 1,320,240,1
rem Make the bullet sprite
sprite 2,320,240,2
rem Begin loop
do
rem Tell the you what the life of our bullet is
set cursor 0,0 : print "USE THE ARROW KEYS TO MOVE AND SPACE TO SHOOT." : print "BULLET LIFE: ",BulletLife
rem Decrease the life of our bullet
BulletLife=BulletLife-1
rem Move the bullet sprite. It is always moving.
Move sprite 2,4
rem Press space to shoot. It will only work if the bullet's life is less than or equal to 0.
rem In other words, you can only shoot once the previous bullet has died. To make a bullet die, make it's life equal to 0.
if spacekey() and BulletLife<=0
rem Put the bullet back to where you are
sprite 2,sprite x(1),Sprite y(1),2
rem Make it face the same way that you are
rotate sprite 2,Sprite Angle(1)
rem Set the life of our bullet to 100. When this reaches 0 then the bullet will no longer be visible.
BulletLife=50
rem NOTE: When checking to see if the bullet hits something, maek sure that its life is over 0. It can't be hitting something if it's supposed to be dead!
endif
rem Control our player sprite
if upkey() then move sprite 1,1
if downkey() then move sprite 1,-1
if leftkey() then rotate sprite 1, Sprite angle(1)-3
if rightkey() then rotate sprite 1, Sprite angle(1)+3
if BulletLife>0
show sprite 2
else
hide sprite 2
endif
sync
loop
Ummm...