Graphics 1600,900,1
SetBuffer BackBuffer()
Type player
Field x,px,deltax
Field y,py,deltay
End Type
Type car
Field x,px,deltax
Field y,py,deltay
End Type
Type TBullet
Field bx#, by#, angle#
End Type
Function TBullet_Update()
For b.TBullet = Each TBullet
bx = bx - Cos(angle)*2
by = by -Sin(angle)*2
If bx<0 Or bx>GraphicsWidth() Or by<0 Or by>GraphicsHeight() Then
Delete b
End If
Next
End Function
Function TBullet_Draw()
For b.TBullet = Each TBullet
Oval(bx - 3, by - 3, 6, 6)
Next
End Function
Global bx=140
Global by=100
Global chn=Rnd(4)
Global w=LoadImage("w.bmp")
Global Tbullet=LoadImage("shot.bpm")
Global dmgC#
Global y=100
Global x=100
Global speed#=3
Global zdorov#=100
Global speedc#=5
Global hp100=LoadImage("hp100.bmp")
Global hp80=LoadImage("hp80.bmp")
Global hp60=LoadImage("hp60.bmp")
Global hp40=LoadImage("hp40.bmp")
Global hp20=LoadImage("hp20.bmp")
Global cursor=LoadImage("cursor.bmp")
Global polosa=LoadImage("polosa.bmp")
Global Endd=LoadImage("end.bmp")
Global angle
Global player=LoadImage("1.bmp")
TFormFilter enable=0
RotateImage player,90
MidHandle player
Global ground=LoadImage ("ground1.bmp")
Global house1=LoadImage ("house1.bmp")
Global house2=LoadImage ("house2.bmp")
Global car=LoadImage("car1.bmp")
Global cy=Rand(1366)
Dim playerg(361)
For t=0 To 361
playerg(t)=CopyImage(player)
MaskImage playerg(t),0,0,0
RotateImage playerg(t),t
Next
MaskImage hp100,255,255,255
MaskImage hp80,255,255,255
MaskImage hp60,255,255,255
MaskImage hp40,255,255,255
MaskImage hp20,255,255,255
MaskImage player,0,0,10
TileImage ground,0,0,0
Function updateplayer()
player_angle=ATan2(MouseY()-y,MouseX()-x)+180
If MouseDown(1) Then
b.Tbullet=New Tbullet
bx=x
by=y
angle=player_angle
EndIf
DrawImage ground,0,0
DrawImage w,700,100
DrawImage house1,300,340
DrawImage house2,750,340
DrawImage house2,-200,340
DrawImage house1,750,340
DrawImage house2,1250,340
DrawImage house2,750,-90
DrawImage house2,950,-90
DrawImage house2,15,-90
DrawImage house2,0,-90
DrawImage car,555,cy
MaskImage cursor,255,255,255
px=x+speed*deltax
py=y+speed*deltay
DrawImage playerg(Int(player_angle)),x,y
Text 0,10,player_angle
If x<0 Then x = 1366
If x>1366 Then x = 0
If y<0 Then y = 768
If y>768 Then y = 0
cursorX=MouseX()
cursorY=MouseY()
DrawImage cursor,MouseX(),MouseY()
If KeyDown(200) Or KeyDown(17) Then
deltay=-1
EndIf
If KeyDown(208) Or KeyDown(31)
deltay=1
EndIf
If KeyDown(203) Or KeyDown(30)
deltax=-1
EndIf
If KeyDown(205) Or KeyDown(32)
deltax=1
EndIf
px=x+speed#*deltax
py=y+speed#*deltay
;DrawImage house1,300,340
;DrawImage house2,750,340
;DrawImage house2,-200,340
;DrawImage house1,750,340
;DrawImage house2,1250,340
;DrawImage house2,750,-90
;DrawImage house2,950,-90
;DrawImage house2,15,-90
;DrawImage house2,0,-90
If Not ImagesCollide (house1,300,340,0,player,px,py,0)
x=px
y=py
EndIf
If ImagesCollide(player,x,y,0,car,555,cy,0) Then zdorov#=zdorov#-2
If zdorov#>80 And zdorov#=<100 Then DrawImage hp100,5,5
If zdorov#>60 And zdorov#=<80 Then DrawImage hp80,5,5
If zdorov#>40 And zdorov#=<60 Then DrawImage hp60,5,5
If zdorov#>20 And zdorov#=<40 Then DrawImage hp40,5,5
If zdorov#>0 And zdorov#=<20 Then DrawImage hp20,5,5
If zdorov#<0 Then DrawImage endd,0,0
End Function
While Not KeyDown(1)
updateplayer()
TBullet_Update()
TBullet_Draw()
Flip
Cls
DrawImage polosa,538,83
If 1=1 Then cy=cy+speedc#
If cy<0 Then cy = 768
If cy>768 Then cy = 0
If ImagesCollide(polosa,538,86,0,car,555,cy,0) Then speedc#=1
If Not ImagesCollide(polosa,538,86,0,car,555,cy,0) Then speedc#=5
Wend