offparkway
Active member
Howdy!
In the brawler module, button B punches. My player stops movement while punching, and then continues. Great.
I copied the punch script (only changing the action step number) and assigned it to button A for a kick animation. It works, and my player kicks. Looks good. But he won't stop moving when he kicks, which leaves the "foot" object behind until it destroys.
The scripts for punching and kicking are identical, so I'm at a loss. Anyone know why the "StopMoving" line of code works for the punch, but not the kick?
(I do have button A also set to activate NPC text as well. I thought maybe that was causing problems, so I removed the NPC function. But it made no difference).
Here's the kick script:
In the brawler module, button B punches. My player stops movement while punching, and then continues. Great.
I copied the punch script (only changing the action step number) and assigned it to button A for a kick animation. It works, and my player kicks. Looks good. But he won't stop moving when he kicks, which leaves the "foot" object behind until it destroys.
The scripts for punching and kicking are identical, so I'm at a loss. Anyone know why the "StopMoving" line of code works for the punch, but not the kick?
(I do have button A also set to activate NPC text as well. I thought maybe that was causing problems, so I removed the NPC function. But it made no difference).
Here's the kick script:
Code:
TXA
STA temp ;; assumes the object that we want is in x.
GetActionStep temp
CMP #$03 ;; is it already kicking?
BNE +canKick
;; wait until we're back to idle to kick again.
RTS
+canKick
ChangeActionStep temp, #$03 ;; assumes that "kick" is in action 3
;arg0 = what object?
;arg1 = what behavior?
StopMoving temp, #$FF, #$00
WEAPON_POSITION_RIGHT_X = #$10
WEAPON_POSITION_RIGHT_Y = #$08
WEAPON_POSITION_LEFT_X = #$F8
WEAPON_POSITION_LEFT_Y = #$08
WEAPON_OBJECT = #$08
WEAPON_RIGHT_STATE = #$00
WEAPON_LEFT_STATE = #$01
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Now, we have to create the object.
;; We will need to determine the direction
;; of the player.
LDX player1_object
TXA
STA temp
GetObjectDirection temp ;; temp still observed from above.
;;; this object's direction is now loaded into the
;;; accumulator for comparison after the macro.
;; 0 = down
;; 1 = downright
;; 2 = right
;; 3 = upright
;; 4 = up
;; 5 = upleft
;; 6 = left
;; 7 = downleft
CMP #$02
BNE +notRight
;;; CREATE RIGHT WEAPON
LDX player1_object
LDA Object_x_hi,x
CLC
ADC #WEAPON_POSITION_RIGHT_X
STA tempA
LDA Object_screen,x
ADC #$00
STA tempD
LDA Object_y_hi,x
CLC
ADC #WEAPON_POSITION_RIGHT_Y
STA tempB
LDA #WEAPON_OBJECT
STA tempC
;; use this is you want to always create a single object, based on
;; the constant above.
; CreateObject tempA, tempB, #WEAPON_OBJECT, #WEAPON_RIGHT_STATE, currentNametable
;;; use this if you want to create a variable object based on
;;; the weaponChoice varaible.
CreateObjectOnScreen tempA, tempB, tempC, #WEAPON_RIGHT_STATE, tempD
LDA #%11000000
STA Object_direction,x
JMP +doneWithCreatingWeapon
+notRight
;;; CREATE LEFT WEAPON
LDX player1_object
LDA Object_x_hi,x
CLC
ADC #WEAPON_POSITION_LEFT_X
STA tempA
LDA Object_screen,x
SBC #$00
STA tempD
LDA Object_y_hi,x
CLC
ADC #WEAPON_POSITION_LEFT_Y
STA tempB
LDA #WEAPON_OBJECT
STA tempC
;; use this is you want to always create a single object, based on
;; the constant above.
; CreateObject tempA, tempB, #WEAPON_OBJECT, #WEAPON_DOWN_STATE, currentNametable
;;; use this if you want to create a variable object based on
;;; the weaponChoice varaible.
CreateObjectOnScreen tempA, tempB, tempC, #WEAPON_LEFT_STATE, tempD
LDA #%10000000
STA Object_direction,x
JMP +doneWithCreatingWeapon
;+notLeft
+doneWithCreatingWeapon
RTS