Тема: Flight
Показать сообщение отдельно
Старый 08.02.2012, 18:39   #2
Spy4433
ПроЭктировщик
 
Аватар для Spy4433
 
Регистрация: 16.04.2008
Сообщений: 161
Написано 36 полезных сообщений
(для 63 пользователей)
Ответ: Flight

player_angle=atan2(mousex()-playerx,mousey()-playery)
playerx=playerx+cos(player_angle)
playery=playery+sin(player_angle)

вот вроде без ошибок должно быть дальше думаю сам докуришь
и кстати рисовать плеера я думаю надо только один раз
Graphics 1366,768,32,1

SetBuffer BackBuffer()

Global x=100
Global y=100
Global speed=3
Global zdorov=100
Global speedc=5
Global cursor=LoadImage("cursor.bmp")
Global polosa=LoadImage("polosa.bmp")
Global Endd=LoadImage("end.bmp")
Global player=LoadImage("1.bmp")
Global ground=LoadImage ("ground1.bmp")
Global house1=LoadImage ("house1.bmp")
Global bot=LoadImage("bot.bmp")
Global car=LoadImage("car1.bmp")
Global cy=Rand(1366)

MaskImage player,0,0,10
TileImage ground,0,0,0

Function updateplayer()
DrawImage player,x,y
MidHandle player
DrawImage player,x,y
DrawImage ground,0,0
DrawImage house1,300,400
DrawImage car,555,cy
f=LoadFont ("courier",40,False,False,False)
MaskImage cursor,255,255,255
px=x+speed*deltax
py=y+speed*deltay
DrawImage player,x,y
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
y=y-speed
DrawImage player,x,y
EndIf 
If KeyDown(208) Or KeyDown(31)
y=y+speed
DrawImage player,x,y
EndIf
If KeyDown(203) Or KeyDown(30)
x=x-speed
DrawImage player,x,y 
EndIf
If KeyDown(205) Or KeyDown(32)
x=x+speed
DrawImage player,x,y
EndIf
SetFont f
Color 255,0,0
Text 10,10,"health = "+ zdorov
;If x=332 Or x=300 Or y=400 Or y=432 Then speed=0
If ImagesCollide(player,x,y,0,car,555,cy,0) Then zdorov=zdorov-4 
If zdorov<0 Then DrawImage endd,0,0
End Function
While Not KeyDown(1)
updateplayer()
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
End
красным выделено то что не нужно т.к есть то ,что выделено зеленым
__________________
форум эт вещь... и почему я раньше им не пользовался?

AMD Phenom(tm) II X6 3.20GHz 8GB GTX 550(1Gb)
(Offline)
 
Ответить с цитированием