The Mugen Fighters Guild
Help => M.U.G.E.N Development Help => Code Library => Topic started by: O Ilusionista on August 14, 2011, 06:21:49 pm
-
While coding Snakeman's Search Snake, I've discovered a way to make the helper (or the char) to bind on the walls.
For Mugen 1.0:
[State 0, PosAdd]
type = PosAdd
trigger1 = facing = 1
x =GameWidth-ScreenPos X
ignorehitpause = 1
[State 0, PosAdd]
type = PosSet
trigger1 = facing = -1
x =-GameWidth/2
ignorehitpause = 1
For Winmugen:
[State 0, PosAdd]
type = PosAdd
trigger1 = facing = 1
x =320-ScreenPos X
ignorehitpause = 1
[State 0, PosAdd]
type = PosSet
trigger1 = facing = -1
x =-160
ignorehitpause = 1
Additionally, if you need to bind the helper to the top of the screen(I don't remember who made that, maybe it was Hero):
[State 0, PosSet]
type = PosAdd
trigger1 = 1
y = 0-ScreenPos Y
ignorehitpause = 1
persistent = 1
-
You could also set a temporary Float Variable to the players current X position, assuming the player/helper is already on the wall. Use PosSet 'x = FVar(#)'. This way, you wouldn't really have to rely on which way the character is facing. Not to mention if the player/helper somehow is facing the wrong way, might give an awkward result.
Though if the player is not starting at the wall, you could still set the variable only when the player hits the wall. Then use this variable to bind to the wall.
Just a thought. :)
-
Binding to the top edge of the screen and to the walls of the screen is as simple as:
[State 1000, PosSet]
Type = PosSet
Trigger1 = 1
X = GameWidth*0.5*Facing
Y = Pos Y - ScreenPos Y
You don't need to use a posadd and a posset for the different facings. If you're setting a position, it's best to just use a posset. PosAdd is better for jumping to specific spots during one tick.
:P