Jump to content
  • 0

Crouch walk code bug


Risotto

Question

Hello folks, i have trouble with my code, when i crouch with my char he can walk forward or backward but then the crouching animation freeze on the first frame. The crouching animation get back to normal after one attack but it freeze when i walk forward while crouching, here my code :

 

Spoiler

 

; Crouch Walk

;---------------------------------------------------------------------------

 

[Statedef 16]

type = C

physics = C

sprpriority = 0

 

[State 16, 1]

type = VelSet

trigger1 = command = "holdfwd"

x = const(velocity.walk.fwd.x)

 

[State 16, 3]

type = ChangeAnim

triggerall = vel x > 0

trigger1 = Anim != 16 && Anim != 6

trigger2 = Anim = 6 && AnimTime = 0

value = 16

 

[State 16, End]

type = ChangeAnim

triggerall = vel x < 0

trigger1 = Anim != 17 && Anim != 6

trigger2 = Anim = 6 && AnimTime = 0

value = 17

 

[State 16, 3]

type = ChangeAnim

trigger1 = command != "holdfwd"

value = 11

 

[State 0, ChangeState]

type = ChangeState

trigger1 = command = "holdback"

value = 17

ctrl = 1

;---------------------------------------------------------------------------

; Crouch Walk Backwards

;---------------------------------------------------------------------------

[Statedef 17]

type = C

physics = C

sprpriority = 0

 

[State 17, 1]

type = VelSet

trigger1 = command = "holdback"

x = const(velocity.walk.back.x)

 

[State 17, 3]

type = ChangeAnim

triggerall = vel x > 0

trigger1 = Anim != 16 && Anim != 6

trigger2 = Anim = 6 && AnimTime = 0

value = 16

 

[State 17, End]

type = ChangeAnim

triggerall = vel x < 0

trigger1 = Anim != 17 && Anim != 6

trigger2 = Anim = 6 && AnimTime = 0

value = 17

 

[State 17, 3]

type = ChangeAnim

trigger1 = command != "holdback"

value = 11

 

[State 0, ChangeState]

type = ChangeState

trigger1 = command != "holdback"

value = 16

ctrl = 1

 

 

After some test its seems the problem is in the first part of the code the walk forward crouch animation, however I've failed to find the culprit in the code, can you see what I've done wrong ? 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
On 6/4/2016 at 4:28 AM, Risotto said:

[State 16, 3]

type = ChangeAnim

trigger1 = command != "holdfwd"

value = 11

 

[State 17, 3]

type = ChangeAnim

trigger1 = command != "holdback"

value = 11

 

The problem is these two blocks. You need to add triggerall = Anim != 11 to prevent the sctrl from triggering repeatedly.

 

Alternatively, you can replace ChangeAnim with ChangeState to have him go back to State 11.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...