Parry coding

Started by Creamy_Goodness, June 13, 2008, 09:24:51 PM

Previous topic - Next topic

Creamy_Goodness


> I'm currently coding a parry for an original character (Brandy), and I'm having three problems with my code. First, I want to have the player tap forwards once to parry each hit, but if a beam comes at Brandy, and the player parries the first hit, Brandy automatically parries all of the hits until her parry timing window closes. This is easy to notice because of her wide timing window (15 ticks). I think I may have to immediately close the timing window after each hit, but I'm not sure how to do this. The second problem I'm having is that once the timing window closes, Brandy can't parry anymore hits in the beam, so she is forced to take normal damage from whatever's left of it. Finally, if Brandy taps forward to parry, and then starts an attack at last split second before her opponent's attack hits, she will interrupt her own attack to parry. Is there a way to cancel the parry state if Brandy interrupts it?

> Here is the code in question. It was PotS's old parry code that BigBoss posted here, but I since cut it down heavily so I could better understand what was left of it.

> In the CMD...

;---------------------------------------------------------------------------
; Parry High
[State -1, Parry High]
type = HitOverride
triggerall = command = "fwd"
trigger1 = ctrl
trigger1 = statetype = S ;can't parry in the air
;attr = SA,AA,AP
attr = SA, AA, AP
stateno = 508 ;switches to State 508 (Parry High)
time = 15 ;parry timing window

;---------------------------------------------------------------------------
; Parry Low
[State -1, Parry Low]
type = HitOverride
triggerall = command = "downfwd"
trigger1 = ctrl
trigger1 = statetype = S ;can't parry in the air
attr = C, NA, AP
stateno = 509 ;switches to State 509 (Parry Low)
time = 15 ;parry timing window

> In the CNS...

;---------------------------------------------------------------------------
; Parry High

[Statedef 508]
type = S ;can only do while standing
physics = S ;Stand physics apply friction to Brandy
anim = 508 ;switches to Parry animation (sprites)
velset = 0, 0 ;holds Brandy in place
ctrl = 0 ;player loses control of Brandy
poweradd = 100 ;Brandy gains 100 points of energy

[State 508, Pause]
type = Pause ;type of state: freezes the game
trigger1 = AnimElem = 1 ;kicks in when animation reaches its first frame
time = 10 ;freezes the opponent for 10 ticks

[State 508, NHB]
type = NotHitBy ;type of state: Makes Brandy immune to certain attacks
trigger1 = Time = 0 ;kicks in immediately
value = SA, AA, AP ;immune to standing and air attacks, and projectiles

[State 508, LifeAdd]
type = LifeAdd ;type of state: Brandy regains some health
trigger1 = Time = 0 ;kicks in immediately
value = 10 ;Brandy gains 10 points of health

[State 508, End]
type = ChangeState ;type of state: Change State
trigger1 = Time = 1 ;kicks in after 1 tick
value = 0 ;switches to State 0 (Stance)
ctrl = 1 ;player regains control of Brandy

;---------------------------------------------------------------------------
; Parry Low

[Statedef 509]
type = S ;can only do while standing
physics = S ;Stand physics apply friction to Brandy
anim = 509 ;switches to Crouch - Parry animation (sprites)
velset = 0, 0 ;holds Brandy in place
ctrl = 0 ;player loses control of Brandy
poweradd = 100 ;Brandy gains 100 points of energy

[State 509, Pause]
type = Pause ;type of state: freezes the game
trigger1 = AnimElem = 1 ;kicks in when animation reaches its first frame
time = 10 ;freezes the opponent for 10 ticks

[State 509, NHB]
type = NotHitBy ;type of state: Makes Brandy immune to certain attacks
trigger1 = AnimTime = 0 ;kicks in immediately
value = C, NA ;immune to crouching attacks

[State 508, LifeAdd]
type = LifeAdd
trigger1 = AnimTime = 0 ;kicks in immediately
value = 10 ;Brandy gains 10 points of health

[State 509, End]
type = ChangeState ;type of state: Change State
trigger1 = Time = 1 ;kicks in after 1 tick
value = 0 ;switches to State 0 (Stance)
ctrl = 1 ;player regains control of Brandy
= = = = = = = = = =
Jason "Creamy Goodness" Tenn
http://creamyg.jdluke.com/