Never mind. I fixed it. Now I have another question. Here is the code:
remstart
-------------------------------------------------------------------
program name: Laser Assault 2
-------------------------------------------------------------------
written by: UFO
date: 11/19/05
-------------------------------------------------------------------
comments:
Image Usage:
(1-3)-player ship
(4)-Player bullet
(20-25) - explosion1
(100^)-Aliens
Sprite Usage:
1 - Player ship
(100-110) - Player Bullets
(10-99) - Aliens
(120-135) = explosions
Sound usage:
1 - Player shoot
Arrays:
PBullet(maxnum,3) - 1=exists 2=x 3=y
Alien(maxnum,5) - 1=exists 2=x 3=y 4=type 5=frame 6 -Height 7-special 8-special2
Explosion(maxnum,3) 1=exists 2=x 3=y 4=frame
-------------------------------------------------------------------
remend
amountofstars=300
Animtimer = timer()
Frame = 1
Dim Stars(amountofstars,3)
Dim Ppos(2)
Ppos(1) = 30
Ppos(2) = 240
maxplayerbullets = 10
Dim PBullet(maxplayerbullets,3)
AlienTimer = timer()
Maxaliens = 20
Dim Alien(Maxaliens,7)
Dim Explosion(15,4)
True = 1
False = 0
Sync on
hide mouse
gosub Init_Stars
gosub Load_Images
gosub load_sounds
gosub Draw_Stars
gosub Draw_Ship
Do
gosub Draw_Stars
gosub Draw_Ship
gosub Move_Ship
gosub Make_Alien
gosub Move_Alien
gosub Draw_Alien
gosub Shooting
gosub Move_Bullets
gosub Draw_Bullets
gosub Bullet_Collision
gosub draw_explosion
gosub Animation
For I = 1 to maxaliens
Print Alien(I,1);
next I
Print "----";
For I = 1 to 15
Print Explosion(I,1);
next I
Print "----";
For I = 1 to 3
Print Explosion(I,4);
next I
sync
Loop
Init_Stars:
For I = 1 to amountofstars
Stars(I,1) = rnd(640)
Stars(I,2) = rnd(320)+80
Stars(I,3) = rnd(9)+1
next I
return
Draw_Stars:
cls
Ink rgb(255,255,255),0
For I = 1 to Amountofstars
Stars(I,1) = Stars(I,1) - Stars(I,3)
If Stars(I,1) < 0 then Stars(I,1) = 640
Dot Stars(I,1),Stars(I,2)
next I
return
Load_images:
Load image "media/Player/Ablast1.bmp",1
Load image "media/player/Ablast2.bmp",2
Load image "media/player/Ablast3.bmp",3
Load image "media/player/Bullet.bmp",4
Load image "media/explosions/1.bmp",50
Load image "media/explosions/2.bmp",51
Load image "media/explosions/3.bmp",52
Load image "media/explosions/4.bmp",53
Load image "media/explosions/5.bmp",54
Load image "media/explosions/6.bmp",55
Load image "media/aliens/1-1.bmp",100
Load image "media/aliens/1-2.bmp",101
Load image "media/aliens/1-3.bmp",102
Load image "media/aliens/2-1.bmp",103
Load image "media/aliens/2-2.bmp",104
Load image "media/aliens/2-3.bmp",105
Load image "media/aliens/3-1.bmp",106
Load image "media/aliens/3-2.bmp",107
Load image "media/aliens/3-3.bmp",108
Load image "media/aliens/4-1.bmp",109
Load image "media/aliens/4-2.bmp",110
Load image "media/aliens/4-3.bmp",111
Load image "media/aliens/5-1.bmp",112
Load image "media/aliens/5-2.bmp",113
Load image "media/aliens/5-3.bmp",114
return
Load_sounds:
Load sound "media/sounds/phaser.wav",1
Load sound "media/sounds/explode.wav",5
Draw_SHip:
Sprite 1,ppos(1),ppos(2),frame
return
Animation:
If Animtimer < timer() - 50
Frame = Frame + 1
For I = 1 to maxaliens
Alien(I,5) = Alien(I,5) + 1
If Alien(I,5) = 4 then Alien(I,5) = 1
next I
For I = 1 to 15
If explosion(I,1) = true
Explosion(I,4) = Explosion(I,4) + 1
If Explosion(I,4) = 7 then Explosion(I,1) = false
endif
next I
animtimer = timer()
endif
If Frame = 4 then Frame = 1
return
Move_Ship:
If upkey() = true then ppos(2) = curvevalue(ppos(2)-25,ppos(2),4)
If downkey() = true then ppos(2) = curvevalue(ppos(2)+25,ppos(2),4)
If leftkey() = true then ppos(1) = curvevalue(ppos(1)-25,ppos(1),4)
If rightkey() = true then ppos(1) = curvevalue(ppos(1)+25,ppos(1),4)
If ppos(1)<0 then ppos(1) = 1
If ppos(1)>640-sprite width(1) then ppos(1) = 639-sprite width(1)
If ppos(2)<80 then ppos(2) = 81
If ppos(2)>400-sprite height(1) then ppos(2) = 399-sprite height(1)
return
Shooting:
If shiftkey() = true and shoot = true
shoot = false
Play sound 1
For I = 1 to maxplayerbullets
If PBullet(I,1) = false
PBullet(I,1) = true
PBullet(I,2) = Ppos(1)+sprite width(1)-20
PBullet(I,3) = Ppos(2)+(sprite height(1)/2)-2
Goto leave
endif
next I
leave:
endif
If shiftkey() = false then shoot = true
return
Move_Bullets:
For I = 1 to maxplayerbullets
If PBullet(I,1) = true
PBullet(I,2) = curvevalue(PBullet(I,2)+50,PBullet(I,2),3)
If PBullet(I,2) > 700 then PBullet(I,1) = false
endif
next I
return
Draw_Bullets:
For I = 1 to maxplayerbullets
If PBullet(I,1) = true then Sprite 99+I,PBullet(I,2),PBullet(I,3),4
next I
return
Bullet_Collision:
For I = 1 to maxplayerbullets
If Sprite exist(99+I) = true
For N = 1 to maxaliens
If sprite exist(9+N) = true
If Sprite hit(I+99,9+N) = true
Alien(N,1) = false
PBullet(I,1) = false
Make_Explosion(Sprite x(99+I)+sprite width(99+I)-11,Sprite y(99+I)-10)
sprite I+99,640,480,1
sprite N+9,0,480,1
endif
endif
Next N
endif
Next I
return
Make_Alien:
If alientimer < timer() - 250
alientimer = timer()
For I = 1 to maxaliens
If Alien(I,1) = false
Alien(I,1) = true
Alien(I,2) = 640
Alien(I,4) = rnd(4)+1
If alien(I,4) = 5 then Alien(I,4) = 13
If alien(I,4) = 4 then Alien(I,4) = 10
If Alien(I,4) = 3 then Alien(I,4) = 7
If alien(I,4) = 2 then Alien(I,4) = 4
Alien(I,5) = 1
If alien(I,4) = 1 then Alien(I,6) = 21
If alien(I,4) = 4 then Alien(I,6) = 39
IF alien(I,4) = 7 then Alien(I,6) = 32
If alien(I,4) = 10 then Alien(I,6) = 31
If alien(I,4) = 13 then Alien(I,6) = 33
IF alien(I,4) = 7 then Alien(I,7) = 50
If alien(I,4) = 10 then Alien(I,7) = rnd(1)+1
IF Alien(I,4) = 10 and Alien(I,7) = 1 then Alien(I,7) = 5
IF Alien(I,4) = 10 and Alien(I,7) = 2 then Alien(I,7) = -5
Alien(I,3) = rnd(320-Alien(I,6))+80
goto leavethisplace
endif
next I
Leavethisplace:
endif
return
Move_Alien:
For I = 1 to maxaliens
If Alien(I,1) = true
If Alien(I,4) = 1
Alien(I,2) = Alien(I,2) - 4
If ppos(2) > Alien(I,3) then Alien(I,3) = Alien(I,3) + 1
If ppos(2) < Alien(I,3) then Alien(I,3) = Alien(I,3) - 1
If Alien(I,2) < -30 then Alien(I,1) = false
endif
If Alien(I,4) = 4
Alien(I,2) = Alien(I,2) - 10
If Alien(I,2) < -50 then Alien(I,1) = false
endif
If Alien(I,4) = 7
Alien(I,2) = Alien(I,2) - int(Alien(I,7)/2)
Alien(I,7) = Alien(I,7) - 1
If Alien(I,2) > 645 then Alien(I,1) = false
endif
If alien(I,4) = 10
Alien(I,2) = Alien(I,2) - 7
Alien(I,3) = Alien(I,3) + Alien(I,7)
If Alien(I,3) < 75 then Alien(I,7) = 5
If Alien(I,3) > 415-Alien(I,6) then Alien(I,7) = -5
If Alien(I,2) < -50 then Alien(I,1) = false
endif
If alien(I,4) = 13
Alien(I,2) = Alien(I,2) - 10
If ppos(2) > Alien(I,3)+10 then Alien(I,3) = Alien(I,3) + 3
If ppos(2) < Alien(I,3)-10 then Alien(I,3) = Alien(I,3) - 3
If Alien(I,2) < -50 then Alien(I,1) = false
endif
endif
next I
return
Draw_Alien:
For I = 1 to maxaliens
If Alien(I,1) = true then Sprite 9+I,Alien(I,2),Alien(I,3),98+Alien(I,4)+Alien(I,5)
next I
return
Draw_Explosion:
For I = 1 to 15
If Explosion(I,1) = true then sprite 119+I,100,100,19+Explosion(I,4)
next I
return
Function Make_Explosion(x,y)
Play sound 5
For I = 1 to 15
If Explosion(I,1) = 0
Explosion(I,1) = 1
Explosion(I,2) = x
Explosion(I,3) = y
Explosion(I,4) = 1
goto getout
endif
next I
getout:
endfunction
Fade_Out:
Done=0
T=Timer()
EndTime#=T+(2000): Rem 1000=1 second 2000=2 seconds and so on
Step#=EndTime#-T
Repeat
CurT#=Timer()-T
Ratio#=CurT#/Step#
RGBVal=255-(255*Ratio#)
If RGBVal<0 then RGBVal=0 : Done=1
Set Gamma RGBVal,RGBVal,RGBVal
Sync
Until Done=1
Return
Fade_In:
Done=0
T=Timer()
EndTime#=T+(2000): Rem 1000=1 second 2000=2 seconds and so on
Step#=EndTime#-T
Repeat
CurT#=Timer()-T
Ratio#=CurT#/Step#
RGBVal=(255*Ratio#)
If RGBVal>255 then RGBVal=255 : Done=1
Set Gamma RGBVal,RGBVal,RGBVal
Sync
Until Done=1
Return
And the media is attached. The explosions don't work. Some debug stuff is printed at the top of the screen when the game is running.
Dodik, please don't post here unles it is helpful.