ok here is my listing (i knew i should have posted it)
See what you think and thank you for the help.
;*************************
;*************************
;*** PC Invaders ***
;*** ***
;*** By Preston Thomas ***
;*************************
;*************************
;graphics mode and set fps
Graphics 600,480,16,2
timer = CreateTimer(60)
;load images
AutoMidHandle True
;load ship
img_ship = LoadImage("ship.png")
img_shipgreen = LoadImage ("shipgreen.png")
img_shipblue = LoadImage ("shipblue.png")
img_shipred = LoadImage("shipred.png")
;load laser
img_bullet = LoadImage("fire.png")
;load alien
img_alien = LoadImage("alien.png")
;load alienfire
img_afire = LoadImage("afire.png")
;load gameover
img_gameover = LoadImage("gameover.png")
img_title = LoadImage("title.png")
;load sounds
snd_laser1 = LoadSound("lazer.wav")
snd_aexplode = LoadSound("alien exp.wav")
snd_laugh = LoadSound("speccy laugh.wav")
snd_tune = LoadSound ("invaders tune.wav")
.menu
;load hiscore
Cls
If ReadFile("score.dat") = 0 Then
highscore = 100
Else
file_score = ReadFile("score.dat")
highscore = ReadInt (file_score)
CloseFile (file_score)
EndIf
chnBackground=PlayMusic("invaders tune.wav")
;draw menu
While Not KeyDown (1)
If KeyDown(57) Then StopChannel chnBackground : Goto game
DrawImage img_title,300,240
Flip
Wend
.game
;graphics mode and set fps
SetBuffer BackBuffer()
;type bullet
Type bullet
Field x
Field y
End Type
;type alien
Type alien
Field x
Field y
End Type
;type bomb
Type bomb
Field x
Field y
End Type
;set up where ship has to be
x=300
y=450
;sets up lives
lives = 3
;sets up score
score = 0
;sets alien speed
aspeed = 2
amx = aspeed
chdir = False
;number of aliens
numaliens=0
;level to start on
level = 20
timer = CreateTimer(level)
;start main loop
While Not KeyDown(1)
If numaliens = 0 Then
;add level
level = level + 1
timer = CreateTimer(level)
;generate aliens
For z = 1 To 10
For w = 1 To 5
a.alien = New alien
a\x = 50 + 40*z
a\y = 50 + 40*w
Next
Next
EndIf
;clear screen
Cls
;draw player
DrawImage img_ship,x,y
If KeyDown(50) Then x=x+3
If KeyDown(49) Then x=x-3
If KeyDown(1) Then End
If x<20 Then x=20
If x>580 Then x=580
;fire bullet
If KeyHit(57) Then
PlaySound(snd_laser1)
b.bullet = New bullet
b\x = x
b\y = y - 5
EndIf
;update and draw
For b.bullet = Each bullet
b\y = b\y - 5
If b\x < 0 Then Delete b
DrawImage img_bullet,b\x,b\y
Next
;movement for aliens
If chdir = True Then
amx = -amx
EndIf
chdir = False
numaliens = 0
;update and draw aliens
For a.alien = Each alien
;count aliens
numaliens = numaliens +1
;move alien
a\x = a\x + amx
If a\x > 580 Then chdir = True
If a\x < 20 Then chdir = True
;generate bombs
If Rand(250) = 25 Then
bombs.bomb = New bomb
bombs\x = a\x
bombs\y = a\y
EndIf
DrawImage img_alien,a\x,a\y
For b.bullet = Each bullet
If ImagesCollide(img_afire,b\x,b\y,0,img_alien,a\x,a\y,0)
score=score+25
PlaySound (snd_aexplode)
Delete b
Delete a
If score > highscore Then highscore = score
Exit
EndIf
Next
Next
;update and draw bombs
For bombs.bomb = Each bomb
bombs\y = bombs\y+4
DrawImage img_afire,bombs\x,bombs\y
If ImagesCollide(img_afire,bombs\x,bombs\y,0,img_ship,x,y,0)
Delete bombs
lives = lives - 1
ElseIf bombs\y > 500 Then
Delete bombs
EndIf
Next
;endgame screen
If lives=0 Then
;save hiscore
file_score = WriteFile("score.dat")
WriteInt(file_score,highscore)
CloseFile file_score
Cls
PlaySound (snd_laugh)
DrawImage img_gameover,295,250
Flip
Delay 5000
Cls
Flip
Goto menu
EndIf
;display lives
;draw level
Text 40,10,"Shields "+lives,1,1
Text 300,10,"Score "+score,1,1
Text 530,10,"High Score "+highscore,1,1
WaitTimer(timer)
Flip
Wend
|