What I am trying to do is when a bullet is shot and hits an enemy, delete the sprite that it hits. I've edited the code several times to improve it, and get this to work with no luck. It should be rather simple, but I just don't understand why it's not working.
Sync on
Hide Mouse
`load the main game images
Load image "ship.bmp",1,1
load image "back.bmp",2,1
load image "bullet.bmp",3,1
load image "eye.bmp",4,1
`load some sounds
load sound "fire.wav",1
load sound "impact.wav",2
rem players start position
y=370
x=320
`Background
sprite 2,0,0,2
`Set up some bullets
Bullet=3
bullets_life = 0
`enemy row 1
Dim Enemies(16)
Enemies(0)=16
XPOS = 50
sprite 4,300,10,4
for e = 4 to enemies(0)
sprite e,XPOS,10,4
XPOS=XPOS+75
sync
next e
`enemy row 2
XPOS2=75
sprite 11,500,100,11
for e = 11 to enemies(0)
sprite e,XPOS2+15,100,4
XPOS2=XPOS2+75
sync
next e
`Set up some Enemy life variables
Alive = 16
for n = Alive+4 to Enemies(0)
enemies(Alive)=1
next n
sprite 1,x,y,1
OFFSET SPRITE 1, SPRITE WIDTH(1)/2, SPRITE Height(1)/2
`*********************
`******MAIN LOOP******
`*********************
do
`ship
sprite 1,x,y,1
sync
`if upkey()=1 then y=y-2
`if downkey()=1 then y=y+2
if rightkey()=1 then x=x+2
if leftkey()=1 then x=x-2
if x >= 590 then x=x-4
if x <= 60 then x=x+4
`Fire Bullet
if spacekey() = 1 and bulletlife = 0
bulletlife = 1
sprite bullet,x-10,y-40,3
play sound 1
endif
If sprite exist(bullet) then move sprite 3,4 : bulletlife=0
`Try out some collision??
For C = 4 to Enemies(0)
if sprite exist(bullet)
if sprite hit (bullet,Enemies(C))=1 : Enemies(C)=0
If Enemies(C) = 0 then : Delete Sprite Enemies(c)
play sound 2
`delete sprite Hit
endif
endif
Next C
sync
loop