No problem
. I am still very confused by your code (so many if/else statements!), but I think I get what the purpose of it was. Was it meant to make sure you can't shoot all of the bullets at once, and to make sure that there is a delay between bullet shootings? I tried shortening your code by a lot and just adding a new variable called
ShootDelay that counts down until the next time you can shoot. This way the bullets don't all shoot out at once. After each shot ShootDelay gets set to 100 and you can't shoot again until it reaches 0.
I also got rid of your SLEEP command and added SYNC RATE to control the screen refresh rate instead. Changing the SYNC RATE will change the maximum number of FRAMES PER SECOND you can get in your game. Setting it to 0 will make the game run as quickly as your computer will allow it to.
Anyway, here's the changed code...
load bitmap "aviao.bmp",7
get image 1,223,284,283,343,1
get image 3,251,255,257,269,1
get image 5,312,300,373,326,1
delete bitmap 7
sprite 6,100,100,5
BasePosX = 400
MaxBullets = 5
Dim FiredBullet(MaxBullets)
Dim BulletPosX(MaxBullets)
Dim BulletPosY(MaxBullets) as float
Rem Main Program Loop
sync on
sync rate 60
Delay=0
Do
If Leftkey()=1 Then Dec BasePosX,1
If BasePosX<-25 Then BasePosX=-25
If Rightkey()=1 Then Inc BasePosX,1
If BasePosX>600 Then BasePosX=600
sprite 2,BasePosX,400,1
If Spacekey()=1 Then Gosub AddBullet
Gosub MoveBullet
ShootDelay=ShootDelay-1
Sync
`Sleep 1
Loop
MoveBullet:
For N = 1 To MaxBullets
If FiredBullet(N)
BulletPosY(N)=BulletPosY(N)-0.2
sprite 7+N, BulletPosX(N),BulletPosY(N),3
Rem Check For Bullet Going Off Top Of Screen Here And Deal With It
If BulletPosY(N) <= 0
delete sprite 7+N
FiredBullet(N) = 0
Endif
Rem Check For Hit Enemy Here And Deal With It
Endif
Next N
Return
AddBullet:
if ShootDelay<=0
For N = 1 To MaxBullets
If FiredBullet(N)=0
FiredBullet(N)=1
BulletPosX(N) = BasePosX + 27
BulletPosY(N) = 395
ShootDelay=100
Exit
Endif
Next N
endif
Return
Also, about the overlap issue, I think it's just a thing with 2D sprites. Try playing around with SET SPRITE PRIORITY a little bit if you want certain sprites to appear on top of other ones. And if this wasn't what you were talking about then nevermind
<-- Spell based team dueling game!