Please Help me! There is my code AutoMidHandle True
Type player
Field x#,y#,xspd#,yspd#,friction#=0.004,acceleration#=0.008,spdvector#,direction#,maxspd#=0.6
Field turnspd#,turnaccel#=0.1,turnmax#=0.7,turnfriction#=0.04, life
Field entity=LoadImage("player.png")
Method create()
x=400 ; y=300 ' создание плеера в центре экрана
End Method
Method update()
If KeyDown(Key_up)
xspd:+Cos(direction)*acceleration
yspd:+Sin(direction)*acceleration
End If
If KeyDown(Key_down)
xspd:-Cos(direction)*acceleration
yspd:-Sin(direction)*acceleration
End If
spdvector=Sqr(xspd*xspd+yspd*yspd) 'вектор скорости
If spdvector > 0
xspd:-(xspd/spdvector)*friction
yspd:-(yspd/spdvector)*friction
End If
If spdvector>maxspd
xspd:+(xspd/spdvector)*(maxspd-spdvector)
yspd:+(yspd/spdvector)*(maxspd-spdvector)
End If
If spdvector<0.2 ' условие "скольжения"
turnfriction=10
Else
turnfriction=0.04
End If
x:+xspd
y:+yspd
DrawText (spdvector,15,15)
If KeyDown(KEY_RIGHT) turnspd:+turnaccel
If KeyDown(KEY_LEFT) turnspd:-turnaccel
If turnspd>turnmax turnspd=turnmax
If turnspd<-turnmax turnspd=-turnmax
direction:+turnspd
If direction>360 direction:-360
If direction<0 direction:+360
If turnspd>turnfriction Then turnspd:-turnfriction
If turnspd<-turnfriction Then turnspd:+turnfriction
If turnspd < turnfriction And turnspd > -turnfriction Then turnspd=0
SetScale 0.3,0.3
SetRotation direction
DrawImage entity,x,y
SetRotation 0
SetScale 1,1
End Method
EndType
Graphics 800,600,32
water=LoadAnimImage("wateranim.jpg",124,124,0,23)
AutoImageFlags (MASKEDIMAGE)
SetMaskColor (0,0,0)
player1:player=New player
player1.create()
Repeat
Cls
frame=MilliSecs()/92 Mod 23
TileImage (water,0,0,frame)
player1.update()
Flip
Until KeyHit(Key_Escape)
Who know, why setmaskcolor don't work?
|