YesNoOk
avatar

Wall bounce error (Read 878 times)

Started by ziaker, May 12, 2019, 12:48:23 am
Share this topic:
Wall bounce error
#1  May 12, 2019, 12:48:23 am
  • *
    • Brazil


at 0:05

Code:
[State 210, 1]
type = HitDef
triggerall = !movecontact
trigger1 = 1
attr = S, NA
animtype  = Light
damage    = 120,50
guardflag = MA
pausetime = 12,12
sparkno = -1;s6000
guard.sparkno = s7000
sparkxy = -8,-25
hitsound   = S0,13
guardsound = S0,8
ground.type = High
ground.slidetime = 15
ground.hittime  = 15
ground.velocity = -1,-8
air.velocity = -32,-6
fall = 1
envshake.time = 20
envshake.freq = 220
envshake.ampl = -10
envshake.phase = 120
p2stateno = 1790
;targetstate = 1790
;p2facing = 1


the character gets stuck in the idle animation
and don't receive knockback
Re: Wall bounce error
#2  May 12, 2019, 12:58:00 am
  • ****
  • CPU Purple Heart
    • USA
    • https://www.pixiv.net/en/users/8108265
 Think you can post all the wall bounce custom state related code that apparently starts at state 1790 and onward to see what's the problem?
Re: Wall bounce error
#3  May 12, 2019, 02:13:28 am
  • *
    • Brazil
I found a code in another character and it is now working normal.

Here the code:



;------------------
; Hit by Punt Kick - flying through the air
[Statedef 1591]
type    = A
movetype= H
physics = N

[State 2000, VarAdd - modificación horizontal]
type = Varadd
trigger1 = time > 0
v = 10
value = 27

[State 0, AngleDraw]
type = AngleDraw
trigger1 = time > 0
value = var(10)

[State 1291, Velocity]
type = HitVelSet
trigger1 = Time = 0
x = 1
y = 1

[State 1291, Gravity]
type = VelAdd
trigger1 = 1
y = .45


[State 1291, Hit wall]
type = ChangeState
triggerall = Pos y < -15
trigger1 = BackEdgeBodyDist <= 10
trigger2 = FrontEdgeBodyDist <= 10
value = 1592

[State 1291, Hit ground]
type = SelfState
trigger1 = (Vel y > 0) && (Pos y >= 0)
value = 5100

;------------------
; Hit by Punt Kick - hit wall
[Statedef 1592]
type    = A
movetype= H
physics = N

[State 1292, Turn]
type = Turn
trigger1 = (Time = 0) && (FrontEdgeBodyDist <= 30)

[State 1292, Pos]
type = PosAdd
trigger1 = Time = 0
x = 15 - BackEdgeBodyDist

[State 1292, Stop moving]
type = PosFreeze
trigger1 = 1
x = 1
y = 1

[State 1292, No scroll]
type = ScreenBound
trigger1 = 1
value = 1
movecamera = 0,1

[State 1292, Spark]
type = Explod
trigger1 = Time = 0
anim = F72
pos = 0, floor (screenpos y) - 50
postype = back
sprpriority = 3

[State 1292, Anim]
type = ChangeAnim2
trigger1 = Time = 0
value = 1027

[State 1292, Sound]
type = PlaySnd
trigger1 = Time = 0
value = F7,0

[State 1292, State]
type = ChangeState
trigger1 = AnimTime = 0
value = 1193

;------------------
; Hit by Punt Kick - bounce off wall
[Statedef 1193]
type    = A
movetype= H
physics = N

[State 1293, Vel Y]
type = VelSet
trigger1 = Time = 0
y = -7

[State 1293, Vel X]
type = VelSet
trigger1 = Time = 0
x = 3

[State 1293, VelMul]
type = VelMul
trigger1 = 1
x = .98

[State 1293, Turn]
type = Turn
trigger1 = (Time = 0) && (BackEdgeDist < 30)

[State 1293, Gravity]
type = VelAdd
trigger1 = 1
y = .35

[State 1293, Anim 5050]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = !SelfAnimExist(5052)
value = 5050

[State 1293, Anim 5052]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = SelfAnimExist(5052)
value = 5052

[State 1293, Anim 5060]
type = ChangeAnim
trigger1 = Vel Y > -2
trigger1 = Anim = 5050
trigger1 = SelfAnimExist(5060)
persistent = 0
value = 5060

[State 1293, Anim 5062]
type = ChangeAnim
trigger1 = Vel Y > -2
trigger1 = Anim = 5052
trigger1 = SelfAnimExist(5062)
persistent = 0
value = 5062

[State 1293, Hit ground]
type = SelfState
trigger1 = (Vel y > 0) && (Pos y >= 0)
value = 5100




Re: Wall bounce error
#4  May 12, 2019, 02:19:00 am
  • ****
  • CPU Purple Heart
    • USA
    • https://www.pixiv.net/en/users/8108265
 I am not really keen on manipulating P2's variables in custom state if this is to go by.

[State 2000, VarAdd - modificación horizontal]
type = Varadd
trigger1 = time > 0
v = 10
value = 27

 This could potentially bug out P2, which is why P2 may be getting stuck in idle stance.

 Also, Velset is preferable to hitvelset since you have a lot more control over it.