如何在mugen中实现对局内无痛切换地图(且前景背景滚动速度差异化,还不遮挡血条)


所需主要代码块如下

helper

Explod

assertspecial

width

posset

原理简述:

用一到两个helper作为explod载体实现前景和背景滚动速度差异

左右两个锚点helper限制住活动范围

nofg+nobg隐藏原场景

在nobg断言下背景底图(天空背景)加算处理不遮挡血条

前景helper调用 camerapos函数参与计算,实现前景背景滚动速度差异化

下面是贴有简单注释的代码示例

———————————————————

; 地台

[Statedef 3001]

type    = A

movetype= I

physics = N

juggle  = 1

velset = 0,0

ctrl = 0

anim = 9999

sprpriority = 9 

[State 0, Helper]

type = helper ;边界占位符1

triggerall = ishelper(3001) ;3001是地台自己的id

trigger1 = numhelper(3501)=0

name = "-"

helpertype = normal

ID = 3501

stateno = 3005

postype = right

ownpal = 1

supermovetime = 99999

pausemovetime = 99999

ignorehitpause = 1

size.ground.back  = GameWidth/4

size.ground.front = GameWidth/4

[State 0, Helper]

type = helper ;边界占位符2

triggerall = ishelper(3001) ;3001是地台自己的id

trigger1 = numhelper(3502)=0

name = "-"

helpertype = normal

ID = 3502

stateno = 3005

postype = left

ownpal = 1

supermovetime = 99999

pausemovetime = 99999

ignorehitpause = 1

size.ground.back  = GameWidth/4

size.ground.front = GameWidth/4

[State 0, ScreenBound]

type = ScreenBound  

triggerall = ishelper(3001)

trigger1 = 1

value = 1

movecamera = 1,1

ignorehitpause = 1

[State 0, Width]

type = Width   

trigger1 = 1

edge = 100, 100

player =100, 100

ignorehitpause = 1

[State 0, AssertSpecial]

type = AssertSpecial ;特殊断言有一套就够了

trigger1 =1

flag = nomusic  ;关背景音乐

flag2 = nobg    ;关背景

flag3 = nofg     ;关前景

ignorehitpause = 1   ;不受到命中的pausetime影响

[State 9500];地台-远景

type = Explod

trigger1 =time=0

ID = 1815

anim =1815

postype = p1

pos =0,0

vel = 0,0

accel = 0,0

scale = 1.5,1.5

RemoveTime = -1

sprpriority = -5

RemoveOnGethit = 0

ownpal = 1

supermovetime = 0

pausemovetime = 0

bindtime = 0

[State 9500];地台

type = Explod

trigger1 =time=0

ID = 1812

anim =1812

postype = p1

pos = 0,0

vel = 0,0

accel = 0,0

scale = 1.5,1.5

RemoveTime = -1

sprpriority = -2

RemoveOnGethit = 0

ownpal = 1

supermovetime = 0

pausemovetime = 0

bindtime = 0

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

; 背景

[Statedef 3002]

type = A

movetype= I

physics = N

juggle = 1

velset = 0,0

ctrl = 0

anim = 9999

sprpriority = 9

[State 0, NotHitBy]

type = NotHitBy

trigger1 = 1

value = SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT

;value2 = S,NA

time = -1

[State 9500];前景

type = Explod

triggerall =NumExplod(1810)=0

trigger1 =NumExplod(1810)<1

ID = 1810

anim =1810

postype = p1

optop=1

pos =0,6

vel = 0,0

accel = 0,0

scale = 1.5,1.5

RemoveTime = -1

sprpriority = 15

RemoveOnGethit = 0

ownpal = 0

supermovetime = 9999

pausemovetime = 9999

bindtime = -1

[State 0, PosSet]

type = PosSet ;通过调用camerapos函数实现前景背景滚动速度差异化

trigger1 = 1

x = CameraPos x *0.23+0

y = 0

;ignorehitpause =

;persistent =

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

;天空盒(其实和3001完全可以合并成一个)

[Statedef 3003]

type = A

movetype= I

physics = N

juggle = 1

velset = 0,0

ctrl = 0

anim = 9999

sprpriority = 9

[State 9500];背景图,要加算的

type = Explod

trigger1 =time=0

ID = 1816

anim =1816

postype = back

pos = 0,0

vel = 0,0

accel = 0,0

scale = 1.5,1.5

RemoveTime = -1

sprpriority = -99999

RemoveOnGethit = 0

ownpal = 1

supermovetime = 0

pausemovetime = 0

bindtime = -1

[State 9500];可有可无的半透明环境光

type =Explod

trigger1 =time=0

ID = 1819

anim =1819

postype = p1

pos = 0,60

vel = 0,0

accel = 0,0

scale = 1.5,1.5

RemoveTime = -1

sprpriority = 7

RemoveOnGethit = 0

ownpal = 1

supermovetime = 99

pausemovetime = 99

bindtime = -1

ONTOP=1

[State 0, PosSet]

type = PosSet ;居中

trigger1 = 1

x = 0

y = 0

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

; 路障

[Statedef 3005]

type = A

movetype= I

physics = N

juggle = 1

velset = 0,0

ctrl = 0

anim = 9999

sprpriority = 9

[State 0, VarSet]

type = VarSet

triggerall = ishelper(3501)

trigger1 = 1

fvar(1) =helper(3001),pos x

fvar(2) =root,pos x+root,camerapos x

fvar(3) =enemy,pos x;+enemy,camerapos x

fvar(5) =helper(3001),pos x+200

fvar(6) =helper(3001),pos x+-100

ignorehitpause = 1

[State 0, ScreenBound]

type = ScreenBound

triggerall = ishelper(3501)

trigger1 = fvar(2)<(fvar(6)); (helper(3502),pos x+-20) >root,pos x ;(pos x > (parent,pos x+260)) ;&& ( pos x < (parentdist x+-400))

value = 1

movecamera = 1,1

ignorehitpause = 1

[State 0, PosSet]

type = PosSet

triggerall = ishelper(3501)

trigger1 = (helper(3502),pos x+-20) >root,pos x

x =(gamewidth*1)

y = 0

ignorehitpause = 1

[State 0, PosSet]

type = PosSet

triggerall = ishelper(3501)

trigger1 = 1

x =(gamewidth*1) ;-4* ( (fvar(1)-(fvar(2)/fvar(3)) )) ;260;

y = 0

ignorehitpause = 1

[State 0, Width]

type = Width

triggerall = ishelper(3501)

trigger1 = !time

edge =50, 50

player = 50,50

ignorehitpause = 1

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

[State 0, VarSet]

type = VarSet

triggerall = ishelper(3502)

trigger1 = 1

fvar(1) =helper(3001),pos x

fvar(2) =root,pos x+root,camerapos x

fvar(3) =enemy,pos x;+enemy,camerapos x

fvar(5) =helper(3001),pos x+200

fvar(6) =helper(3001),pos x+-100

ignorehitpause = 1

[State 0, ScreenBound]

type = ScreenBound

triggerall = ishelper(3502)

trigger1 =1;(helper(3502),pos x+20) (parentdist x+400))

value = 1

movecamera = 1,1

ignorehitpause = 1

[State 0, PosSet]

type = PosSet

triggerall = ishelper(3501)

trigger1 = (helper(3502),pos x+20)

x =(gamewidth*1)

y = 0

ignorehitpause = 1

[State 0, PosSet]

type = PosSet

triggerall = ishelper(3502)

trigger1 = 1

x =4*(camerapos x/10) ;fvar(6);(gamewidth*-1) ;4* ( (fvar(1)-(fvar(2)/fvar(3)) )) ;-400;

y = 0

ignorehitpause = 1

[State 0, Width]

type = Width

triggerall = ishelper(3502)

trigger1 = !time

edge =50, 50

player = 50,50

ignorehitpause = 1

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


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