mod of TDK's shooter tutorial
Set Display Mode 800,600,16
Sync On: CLS 0
Sync Rate 60
Hide Mouse
Set Text Opaque
BasePosX = 400
center Text BasePosX,564,"M"
center Text BasePosX,574,"/ \"
center text baseposx,580,"[ ]"
center text baseposX,580,"_"
MaxBullets = 28
Dim FiredBullet(MaxBullets)
Dim BulletPosX(MaxBullets)
Dim BulletPosY(MaxBullets)
Rem Main Program Loop
Do
If Leftkey()=1 Then Dec BasePosX,8
If BasePosX<0 Then BasePosX=0
If Rightkey()=1 Then Inc BasePosX,8
If BasePosX>788 Then BasePosX=788
CLS
center Text BasePosX,564,"M"
center Text BasePosX,574,"/ \"
center text baseposx,580,"[ ]"
center text baseposX,580,"_"
If Spacekey()=1 Then Gosub AddBullet
If BulletCount > 0 Then Gosub MoveBullet
Text 0,0,"Bullets On Screen: "+Str$(BulletCount)+" "
Sync
Sleep 1
Loop
MoveBullet:
For N = 1 To MaxBullets
If FiredBullet(N)=1
BulletPosY(N)=BulletPosY(N)-20
Text BulletPosX(N),BulletPosY(N),"|"
Rem Check For Bullet Going Off Top Of Screen Here And Deal With It
If BulletPosY(N) <= 0
FiredBullet(N) = 0
Dec BulletCount
Endif
Rem Check For Hit Enemy Here And Deal With It
Endif
Next N
Return
AddBullet:
For N = 1 To MaxBullets
If FiredBullet(N)=0
FiredBullet(N)=1
BulletPosX(N) = BasePosX
BulletPosY(N) = 564
Inc BulletCount
Exit
Endif
Next N
Return