简单飞行+转向及追踪

取自特利迦奥特曼的部分技术

;---------------------------------------------------------------------------

; 简单飞行

[Statedef 111]

type    = A

movetype = I

physics = N

velset = 0,0

ctrl = 0

anim = 40111

sprpriority = 2


[State 810, AfterImage]

type = Afterimage

trigger1 =  time=0

time = -1

length = 10

FrameGap = 3

PalBright = 1,1,1

PalContrast = 175,175,255

PalAdd = 128,128,148

PalMul = 0.35,0.35,0.35

trans=add

[State 0, VelAdd]

type = VelAdd

triggerall = command = "holdup"

trigger1 = vel y > -(var(36))+1

trigger1 = (vel y*vel y)+(vel x* vel x)<=(var(36))*(var(36))

trigger2= vel y >=0

y = -.9


[State 0, VelAdd]

type = VelAdd

trigger1 = vel x >0

trigger1 = command = "holdup"

trigger1 = (vel y*vel y)+(vel x* vel x)>=(var(36))*(var(36))

x = -.3


[State 0, VelAdd]

type = VelAdd

trigger1 = vel x >0

trigger1 = command = "holdup"

trigger1 = (vel y*vel y)+(vel x* vel x)>=(var(36))*(var(36))

x = -.3


[State 0, VelAdd]

type = VelAdd

triggerall = command = "holddown"

trigger1 = vel y < (var(36))-1

trigger1 = (vel y*vel y)+(vel x* vel x)<=(var(36))*(var(36))

trigger2= vel y <=0

y = .9


[State 0, VelAdd]

type = VelAdd

trigger1 = vel x <0

trigger1 = command = "holddown"

trigger1 = (vel y*vel y)+(vel x* vel x)>=(var(36))*(var(36))

x = .3


[State 0, VelAdd]

type = VelAdd

trigger1 = vel x <0

trigger1 = command = "holddown"

trigger1 = (vel y*vel y)+(vel x* vel x)>=(var(36))*(var(36))

x =.3



[State 0, VelAdd]

type = VelAdd

triggerall = command = "holdfwd"

trigger1 = vel x < (var(36))

trigger1 = (vel y*vel y)+(vel x* vel x)<=(var(36))*(var(36))

trigger2= vel x <0

x = 1+(vel x < 0)*-0.3

y= 0 +(vel x < 0)*0.4



[State 0, VelAdd]

type = VelAdd

triggerall = command = "holdback"

trigger1 = vel x > -(var(36))

trigger1 = (vel y*vel y)+(vel x* vel x)<=(var(36))*(var(36))

trigger2= vel x >0

x = -1+(vel x > 0)*0.3

y= 0 +(vel x > 0)*-0.4



[State 804, AngleDraw]

type = AngleDraw

triggerall= vel x >0

trigger1 = TIME>=0

value = (atan(-vel y/vel x)*180/pi)


[State 804, AngleDraw]

type = AngleDraw

triggerall= vel x <0

trigger1 = TIME>=0

value = (atan(-vel y/vel x)*180/pi)+180


[State 804, AngleDraw]

type = AngleDraw

triggerall= vel x =0

triggerall= vel y >0

trigger1 = TIME>0

value = 270


[State 804, AngleDraw]

type = AngleDraw

triggerall= vel x =0

triggerall= vel y <0

trigger1 = TIME>0

value = 90


[State 0, VelSet]

type = Velset

trigger1 =command !="holdup"

trigger1 = pos y>= -15

trigger1 = vel y> 0

y = 0

;ignorehitpause = 

;persistent = 



[State 100, 3] ;Prevent from turning

type = AssertSpecial

trigger1 = 1

flag = NoAutoTurn




[State 105, 3]

type = ChangeState

trigger1 = command!= "holdup"

trigger1 = command!= "holdback"

trigger1 = command!= "holdfwd"

trigger1 = command!= "holddown"

value = 53

ctrl = 1

;-------------------------------------------------------------------------

飞行速度滑块,同理亦可添加滑块控制飞行直线加速度

[State -3, airspeed limit] ;var(36)为最大直线速度

type = VarSet

trigger1 = 1

var(36) = 15





;=-----------------------------------------------------------------------------------


自动跟踪

[State 0, VelSet]

type = VelSet

trigger1 = time=0

x = (p2bodydist x/((p2bodydist x)**2+(p2bodydist y)**2)**0.5)*17

y = (p2bodydist y/((p2bodydist x)**2+(p2bodydist y)**2)**0.5)*6+random%6


;-------------------------------------------------------------------------------------

按速度转向 (自动转向p2同理) 


[State 804, AngleDraw]

type = AngleDraw

triggerall= vel x >0

trigger1 = TIME>=0

value = (atan(-vel y/vel x)*180/pi)


[State 804, AngleDraw]

type = AngleDraw

triggerall= vel x <0

trigger1 = TIME>=0

value = (atan(-vel y/vel x)*180/pi)+180


[State 804, AngleDraw]

type = AngleDraw

triggerall= vel x =0

triggerall= vel y >0

trigger1 = TIME>0

value = 270


[State 804, AngleDraw]

type = AngleDraw

triggerall= vel x =0

triggerall= vel y <0

trigger1 = TIME>0

value = 90


AAA 评论于

大 大佬!

根据相关规定,发布评论前必须绑定手机前往绑定
你,确定要这么做吗?
正在处理中...