YesNoOk
avatar

need help in coding a leap-to-air "jump" attack (Read 12829 times)

Started by lobohobo08, May 23, 2023, 06:37:48 am
Share this topic:
need help in coding a leap-to-air "jump" attack
#1  May 23, 2023, 06:37:48 am
  • avatar
    • USA
so im attempting to code a jus character for the first time, and his jump attack consists of him jumping from the floor and leaping towards player 2, for it to end with a slash through player 2 and making my character appear behind his fallen body.

the sprites of the attack:

https://pasteboard.co/YOgkpZpCgUo6.png

and the effect of the attack im looking for:

SKIP TO THE 13 SECOND MARK AND WATCH AFTERWARDS



i want to know how i can efficitenly make it so the character can jump into the air, hit P2 with the attack, and land right on ground level behind him

i have tried velset , posadd, gravity codes and none of them are giving me the results i want, even repositionig the sprites in the animations doesnt give me the effect that i want. gravity code especially makes my character go past ground level to underneath the stage. i have also tried the following trigger in the changestate code: pos y > 0 && vel y > 0, still doesnt work.

heres my CNS statedef

[Statedef 270]
type = S
movetype= A
physics = S
juggle = 1
ctrl = 0
anim = 270
poweradd = 10
sprpriority = 2

[State 0, VelSet]
type = VelSet
trigger1 = animelem = 2
x = 30
y = -3


[State 0, Gravity]
type = Gravity
trigger1 = time > 9


[State 270, 1]
type = HitDef
trigger1 = !time
attr = A, NA
damage = 23, 0
animtype = hard
guardflag = MA
hitflag = MAF
priority = 3, Hit
pausetime = 8, 8
sparkno = 0
sparkxy = -10, -35
hitsound = s0, 12
guardsound = 6, 0
ground.type = High
ground.slidetime = 0
ground.hittime = 11
ground.velocity = -4
airguard.velocity = -1.9,-.8
air.type = High
air.velocity = -1.4,-3
air.hittime = 15
fall = 1

[State 200, 2]
type = PlaySnd
trigger1 = animelem = 1
value = s0, 11


[State 270, 3]
type = ChangeState
trigger1 = !animtime
value = 0
ctrl = 1

heres my CMD state

[State -1, Y-4]
type = ChangeState
value = 270
triggerall = command = "y"
trigger1 = stateno = 260 && movehit

- - - Updated - - -

the attack starts from the standing position, so its not really a jump attack. its also the finishing attack a combos
Re: need help in coding a leap-to-air "jump" attack
#2  May 31, 2023, 05:50:48 am
  • *****
  • Shame on you!
    • USA
use displaytoclipboard and debug to watch your velocities.
Then use
type = ChangeState
trigger1 = (Pos Y >= 0) && (Vel Y > -5)
or something similar so that your velocity around when you land wont go below the floor. So like if your velocity is usually around 7 to 9, bump it up to check your pos y 7 to 9 pixels higher. Then set the vel y and pos y to 0s. Even if your vel is 7 and you check for pos y at 9 high, moving 2 extra pixels, no one will really notice that.
vVv Ryuko718 Updated 10/31/22 vVv