The Mugen Fighters Guild
Help => M.U.G.E.N Development Help => Topic started by: Skyro on January 22, 2020, 01:36:58 PM
Hello. please I would like to know how to configure a teleportation or a permutation when a key is pressed just before receiving an attack. In console games, when the defense key is pressed just before the attack hits the character, it disappears (or swaps as in Naruto Ultimate ninja storm). That's all. I wish I could avoid an attack by teleporting by pressing the defense button. The teleportation is triggered only if the attack is on the verge of hitting the character.
You can't really tell when an opponent is about to activate a hit. You could activate a reversaldef that lasts a very short period and if hit in that timeframe the teleport occurs but it does mean p2 has to make some sort of contact rather than miss completely.
Just defence works a bit like this but thats possible because everything is on your side. Time of pressing back vs the time before you guard it.
You could use "enemynear,MoveType=A" paired with some arbitrary X distance from your character, as a trigger.
triggerall = enemynear,MoveType=A
triggerall = enemynear,Pos X - Pos X < 100
You should be able to get P2's width and use that to guess the attacking distance.
y = enemynear, Const(size.mid.pos.y)+(enemynear,pos y)+(7*cos(5*pi/60*time))
In Samus to guess where my Metroid should hover.
You should be able to pull the xscale, and the ground.front, and maybe the attack.dist to get an accurate guess. I dont know how good some creators do their attack.dist. Constants are always a guessing game.
I think if you were to get super complex with things, you could attach a helper to P2 that monitors what movetype it's in if you wanted the move to work no matter where P1 is.