How do i get this to make only one bullet everytime i press the space bar?
Rem Project: compo
Rem Created: 6/2/2004 9:37:23 PM
Rem ***** Main Source File *****
`2d thing
`======================
`©NeoEden Productions (http://neoeden.web1000.com)
`======================
`Main Source File
sync on : set display mode 1024,768,32
type player
posx as float
buln
bulx as float
lifes
dead
endtype
type enemy
posx as float
posy as float
buly as float
bulx as float
exist
endtype
gosub load_objects
gosub variables
do
move_player()
`draw
if sprite exist(p.buln) = 1
for i = 2 to p.buln
move sprite i,1
next i
endif
paste image 1,0,0,0
`stop drawing
sync : loop
function move_player()
if rightkey() = 1 and p.posx < 1024 then p.posx = p.posx + 1
if leftkey() = 1 and p.posx > 0 then p.posx = p.posx - 1
if spacekey() = 1 then fire()
sprite 1,p.posx,600,7
endfunction
function move_comp()
endfunction
function fire()
if p.buln = 21 then p.buln = 2
sprite p.buln,p.posx, sprite y(1),2
scale sprite p.buln, 10
p.buln = p.buln + 1
endfunction
load_objects:
`load images
load image "media\bg\bg.bmp",1
load image "media\effects\bullet.png",2
load image "media\effects\fire.png",3
load image "media\effects\green.png",4
load image "media\sprites\aship1.png",5
load image "media\sprites\aship2.png",6
load image "media\sprites\pship.png",7
return
variables:
global p as player
p.buln = 2
global dim e(50) as enemy
return