Post by Azan on Mar 28, 2005 18:01:09 GMT -5
This is a simple little game I edited
Jiub made the enemy ships the enemy deaths and the player firing I did almost everything else, Jiub if you dont want me to post this here please just tell me or move it to the deleted threads board.
Jiub made the enemy ships the enemy deaths and the player firing I did almost everything else, Jiub if you dont want me to post this here please just tell me or move it to the deleted threads board.
Global x=640/2
Global y=480/2+50
Global a = 15
Global b = 15
Global st=0
Global p=0
Global ra=1000
Global rounds=0
Global lives2=2
Global espeed=1
Global inv=0
Global playerspeed=6
Graphics 640,480
SetBuffer BackBuffer()
Type Projectile
Field x,y
End Type
Type Ship
Field x,y
Field hitpoints
End Type
Type eb
Field x2,y2
End Type
targetTime = MilliSecs()+1000
frames = 0
For ex = 100 To 500 Step 50
For ey = 100 To 200 Step 20
enemy.Ship = New Ship
enemy\x = ex
enemy\y = ey
enemy\hitpoints = 1
Next
Next
;;;;;;;;;;;;;;;;;;;
While lives2>0
;;;;;;;;;;;;;;;;;;;
Flip
Cls
update_player()
update_bullets()
update_collisions()
update_enemys()
ueb()
If KeyDown(200) up()
If KeyDown(208) down()
If KeyDown(203) le()
If KeyDown(205) ri()
If KeyHit(57) fire(x,y)
frames = frames + 1
If (MilliSecs() >= targetTime) Then
fps = frames
frames = 0
targetTime = targetTime + 1000
End If
Text(300,10,"fps: "+fps)
Text 100,10,lives2
Text 100,20,inv
Text 100,30,rounds
Wend
;;;;;;;;;;;;;;;;;;;
End;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;
Function update_player()
If inv>0 Then Color 255,0,0
If inv=0 Then Color 0,255,0
Rect x,y,a,b
End Function
Function up()
y=y-playerspeed
End Function
Function down()
y=y+playerspeed
End Function
Function le()
x=x-playerspeed
End Function
Function ri()
x=x+playerspeed
End Function
Function fire(x,y)
bullet.Projectile = New Projectile
rounds=rounds+1
bullet\x = x
bullet\y = y
End Function
Function update_bullets()
Color 0,64,255
For bullet.Projectile = Each Projectile
bullet\y = bullet\y - 4
Rect bullet\x,bullet\y,5,5
If bullet\y <= 0
Delete bullet.projectile
EndIf
Next
End Function
Function update_collisions()
For enemy.Ship = Each Ship
del2=0
For bullet.Projectile = Each Projectile
del=0
If RectsOverlap(bullet\x,bullet\y,5,5,enemy\x-5,enemy\y-5,15,15)
del=1
del2=1
hit=hit-1
EndIf
If del=1 Then Delete bullet.projectile
Next
If del2=1 Then Delete enemy.ship
Next
End Function
Function update_enemys()
For enemy.Ship=Each ship
Color 255,0,0
Rect enemy\x,enemy\y,10,10
If rounds>25 And rounds<50 espeed=2
If rounds>50 And rounds<100 espeed=3
If rounds>50 ra=250
If p=0 enemy\x=enemy\x+espeed
If p=1 enemy\x=enemy\x-espeed
If enemy\x>640 p=1
If enemy\x<0 p=0 enemy\y=enemy\y+3
;random bullet firing
If Rand(ra) = 1
eb.eb = New eb
eb\x2 = enemy\x
eb\y2 = enemy\y
EndIf
Next
End Function
Function ueb()
For f.eb=Each eb
Rect f\x2,f\y2,5,5
f\y2=f\y2+4
If RectsOverlap(f\x2-5,f\y2-5,5,5,x-5,y-5,10,10) And inv<1 lives2=lives2-1 inv=inv+350
If inv>0 Then inv=inv-1
Next
End Function