im makin a shhotem up game that fires from bottom to top, i coded the bullets like this:
#constant playerfire 3
type playerfiretype
spriteno as integer
xpos as integer
ypos as integer
used as integer
endtype
dim playerfire(30) as playerfiretype
global lastplayerfire as integer
lastplayerfire = timer()
load image "playerfire.bmp", playerfire
*****THIS IS THE MAIN GAME LOOP*****
`***main loop
setup()
choose_attack()
repeat
keys = player_input()
move_player(keys)
if timer() - lastambush > 4000
style = choose_attack()
else
move_aliens(style)
endif
move_ammo()
sync
until 1 > 2
sync
**************************************
if timer() - lastplayerfire > 300
if (keys && 16) > 0
x = sprite x(ship)
y = sprite y(ship)
for c = 1 to 30
if playerfire(c).used = 0
sprite c + 2, x + 10, y , playerfire
playerfire(c).xpos = x + 10
playerfire(c).ypos = y
playerfire(c).used = 1
exit
endif
next c
endif
lastplayerfire = timer()
endif
`***player fire, moves each bullet, checks for collision, sorts out if so, checks for edge
for c = 1 to 30
if playerfire(c).used = true
move sprite c + 2, 5
`inc playerfire(c).xpos, 5
for enemy = 34 to 35
if sprite collision (c + 2, enemy)
DELETE sprite c + 2
playerfire(c).used = false
delete sprite enemy
`dec tokill
exit
endif
next enemy
if sprite exist(c+2)
y = sprite y(c + 2)
if y < 0
delete sprite c + 2
playerfire(c).used = false
endif
endif
endif
next c
lastammo = timer()
THIS IS ONLY PARTS OF MY PROGRAM, BUT HOPE IT GIVES U A FEW IDEARS.
LIVE LIFE LOUD LOVE MUSIC
rock, metal, punk, emo, ska, reggae, indie, goth, 70's rock, 80's rock, death metal, poppunk, grunge
***caffine, weed, programming and rock addict***