YesNoOk
avatar

Bind to the Walls (Read 10124 times)

Started by O Ilusionista, August 14, 2011, 06:21:49 pm
Share this topic:
Bind to the Walls
#1  August 14, 2011, 06:21:49 pm
  • ******
  • A living Mugen dinossaur :)
  • 23 years of Mugen O_o
    • Brazil
    • www.brazilmugenteam.com
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:

Quote
[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:

Quote
[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):

Quote
[State 0, PosSet]
type = PosAdd
trigger1 = 1
y = 0-ScreenPos Y
ignorehitpause = 1
persistent = 1
Re: Bind to the Walls
New #2  August 24, 2011, 08:21:22 pm
  • ******
  • Video Game Veteran
  • Can you do it? SUREYOUCAN!
    • USA
    • gcnmario.free.fr
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. :)

"You must defeat my flaming
dragon punch to stand a chance."
Last Edit: August 24, 2011, 10:55:27 pm by N-Mario
Re: Bind to the Walls
#3  August 24, 2011, 08:55:55 pm
  • avatar
  • ******
    • Thailand
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