YesNoOk
avatar

(requesting some advices) How do I Z axis movement (Read 250 times)

Started by Mike77154, April 22, 2019, 06:59:25 am
Share this topic:
(requesting some advices) How do I Z axis movement
#1  April 22, 2019, 06:59:25 am
  • **
  • The need situation makes the man
    • Mexico
    • www.facebook.com/mike.funkyman

  • Online
Good night friends, I have a code that  I want to add to KFM MVC 1.0 template

the idea is that is a Z axis movement like Real bout fatal fury and/or Beat em up style, but the idea is that I want to keep my 3 kick buttons, my 3 punch buttons, and the jump and crouching button, instead I want to remap the z axis movement to the button combination of Start plus directional stick


I put here the code

Code:
;Jumping will have to be placed on a spare button. You may have to rework the character's control scheme or else you won't have a jump button. You can copy your jump start state (40), before modifying it and just using a different state number. I used 42 as it wasn't in use.

;As such you will instead be setting states 10 and 40 to change straight into state 20, your walking state. All of your z axis movement will be handled there via velocity control. Know that if you want to keep air jumping that you create a variable for its number of uses.

;You will override them in your character's main state file instead of on the commons.

;For upward and downward walking you will simply be applying your forward walking speed divided by 2, to the y axis movement.

[State 20, 2]
type = VelSet
trigger1 = command = "holdup"
y = -const(velocity.walk.fwd.x)/2
[State 20, 2]
type = VelSet
trigger1 = command = "holddown"
y = const(velocity.walk.fwd.x)/2

;Make sure to adjust the ChangeAnim so that it'll work for all movement

[State 20, 3]
type = ChangeAnim
triggerall = vel x != 0 || vel y != 0
trigger1 = Anim != 20 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 20
;---------------------------------------------------------------------------
;Walk Downwards
[Statedef 10]
type    = S
physics = S

[State 10]
type = ChangeState
triggerall = prevstateno != 100
trigger1 = !time
value = 20
[State 10]
type = ChangeState
triggerall = prevstateno = 100
trigger1 = !time
value = 100

;---------------------------------------------------------------------------
; Walk Upwards
[Statedef 40]
type    = S
physics = S

[State 40, 6]
type = ChangeState
triggerall = prevstateno != 100
trigger1 = !time
value = 20
[State 40, 6]
type = ChangeState
triggerall = prevstateno = 100
trigger1 = !time
value = 100
;----------------------------------------------------------------------------------

;Universal variable used for z axis will be fvar(39). This will record the Y axis position of your character as the Z axis and will be applied almost all the time. It will not apply itself if the player is airborne at all unless otherwise specified.

[State -2, VarSet]
type = VarSet
triggerall = statetype != A && movetype != H && stateno != 42 ;This checks for aerial, whether you're hurt and the jump start stateno.
trigger1 = 1 ;Always apply if triggers are met
fv = 39 ;Universal Z axis variable
value = pos y ;Set self to position on Y axis, ONLY if not airborne.
ignorehitpause = 1 ;Just in case
persistent = 1 ;Just in case

;This is to control the layer drawn on. For quality sake.

[State -2, SprPriority]
type = SprPriority
trigger1 = 1
value = fvar(39)

;This prevents you from bumping into your opponent.

[State -2, PlayerPush]
type = PlayerPush
trigger1 = 1
value = 0

;This is how you will turn around instead of crossing sides with the opponent.

[State -2, AssertSpecial] ;Prevents auto facing opponent
type = AssertSpecial
trigger1 = 1
flag = noautoturn

[State -2, Turn] ;Turn if back is pressed. Inputs should still read properly.
type = Turn
trigger1 = ctrl && statetype != A ;This prevents you from turning in midair.
trigger1 = command = "holdback" && command != "holdfwd"

;You will need to update all of your airborne landing changestates to use the z axis variable instead of the normal character position on the Y axis. This includes hurt states as well.

;A trigger like this should work in many cases. Just be sure to correct any misalignments by adding or subtracting from the fvar like here.

trigger1 = pos y > fvar(39)-12

;Hitboxes must be tuned to check for the enemy's fvar(39).

triggerall = enemynear,fvar(39) < fvar(39)+10 && enemynear,fvar(39) > fvar(39)-10

;KEEP IN MIND THAT THIS MAY NOT WORK WITH HELPERS! OMIT THIS LINE ON THE PLAYER'S HITBOXES FOR THE TIME BEING

;You may also need to set your character to be able to attack while in your vertical walking states.

;This will prevent you from sliding upwards or downwards while attacking. You should already be unable to travel up or down while jumping.

[State 0, VelSet]
type = VelSet
trigger1 = movetype = A && statetype = S
y = 0

;Running might be both a bit weird and easier as its treated like a move and isn't hardcoded into your normal movement, however it is hardcoded that you are able to crouch and jump out of it. This is why in states 10 and 40 we check for state 100. See the inlcuded "Z Axis Running" file for reference.
;You essentially do the same thing as the walking state.
;Make sure to prevent movement above or below your boundries.

;For throws, you will have to modify your target's z axis variable via the custom state they are in.

[State 0, VarSet]
type = VarSet
trigger1 = !time
fv = 39
value = enemynear,fvar(39)

;Use any trigger required for stability. This will make it so that they'll land at their ground position every time. THIS MAY BREAK CHARACTERS WHO ARE NOT COMPATIBLE!!

;If the character summons helpers of any kind from itself(enemies,projectiles,etc), don't forget to set their z axis to the same as the parent's only on the FIRST frame of being spawned unless you need otherwise.

[State 0, VarSet]
type = VarSet
trigger1 = !time
fv = 39
value = parent,fvar(39)

;Make sure to monitor the variables on the clipboard.

Code:
;---------------------------------------------------------------------------
; Walk
[Statedef 20]
type    = S
physics = S
sprpriority = 0

[State 20, 1]
type = VelSet
trigger1 = command = "holdfwd"
x = const(velocity.walk.fwd.x)

[State 20, 2]
type = VelSet
trigger1 = command = "holdback"
x = const(velocity.walk.fwd.x)

[State 20, 2]
type = VelSet
trigger1 = command = "holdup"
y = -const(velocity.walk.fwd.x)/2
[State 20, 2]
type = VelSet
trigger1 = command = "holddown"
y = const(velocity.walk.fwd.x)/2

[State 0, Velset]
type = Velset
triggerall = vel y < 0 && command != "holdup"
trigger1 = 1
y = 0
[State 0, Velset]
type = Velset
triggerall = vel y > 0 && command != "holddown"
trigger1 = 1
y = 0

[State 20, 3]
type = ChangeAnim
triggerall = vel x != 0 || vel y != 0
trigger1 = Anim != 20 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 20

[State 20, 4]
type = ChangeAnim
triggerall = vel x < 0
trigger1 = Anim != 21 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 21


Code:
 ;---------------------------------------------------------------------------
; RUN_FWD
[Statedef 100]
type    = S
physics = N
sprpriority = 1

[State 0, ChangeAnim] ;This prevents the running animation from resetting.
type = ChangeAnim
trigger1 = anim != 100
value = 100

[State 0, VelAdd]
type = Velset
trigger1 = !time
x = const(velocity.run.fwd.x)

[State 0, VelAdd]
type = Velset
triggerall = vel y < 0 && command != "holdup"
trigger1 = 1
y = 0
[State 0, VelAdd]
type = Velset
triggerall = vel y > 0 && command != "holddown"
trigger1 = 1
y = 0

[State 40, 4]
type = VelSet
trigger1 = command = "holdup"
y = -const(velocity.walk.fwd.x)/2
[State 40, 4]
type = VelSet
trigger1 = command = "holddown"
y = const(velocity.walk.fwd.x)/2

[State 100, 2] ;Prevent run from canceling into walk
type = AssertSpecial
trigger1 = 1
flag = NoWalk

[State 100, 4]
type = ChangeState
trigger1 = command != "holdfwd"
value = 0
[State 100, 4]



so the code is extracted from here
https://BLACKLISTED WEBSITE.com/forums/downloads.php?do=file&id=93929-kfm-zaxis-concept-elecbyte-dmanbro


but I want to add the Z axis feature to the KFM MVC 0.8 mugen 1.0 template


thanks in advance and I wait for your answers please
Re: (requesting some advices) How do I Z axis movement
#2  April 22, 2019, 08:00:43 pm
  • *****
  • Shame on you!
    • USA
I'm not sure how much help you're going to get with this. It seems like all you have to do is cut each chunk of code out and put it in it's respective statedef.
Have you tried this and run into problems?
vVv Wheat Stage Released vVv