vanderblade
Active member
Hey all,
Looks like I once again am using a module nobody else seems to be using. So, I discovered when using the Brawler Module that regardless of whether the player is facing left or right, the weapon sprite (in the tutorial's case, a PlayerFist) doesn't flip orientation. The result is that one of the attack directions is going to have a backwards PlayerFist. If you look closely at the tutorial videos, you'll see this is happening, but Joe doesn't notice. Easy oversight.
There are probably many ways to fix this, but I simply went into the ChangeToAttack_BrawlerBase.asm and changed the two instances of Weapon_Object into Weapon_Object1 and Weapon_Object2. I kept Weapon_Object1 = #$01 (the tutorial PlayerFist) and simply updated the Weapon_Object in the +notRight section to Weapon_Object1.
I used game object #$08 for a dedicated right-oriented PlayerFist, so I made Weapon_Object2 = #$08. I then updated the Weapon_Object when facing right to Weapon_Object2.
There is probably a way to make it work as intended (the game object sprite in #$01 simply flipping between left and right animations depending on player orientation, but I couldn't figure it out. This method does waste a game object spot, so it's not ideal, but for newbies wanting a basic functioning attack that displays the right oriented sprite, this is an easy fix. I'll paste the full ChangeToAttack_BrawlerBase.asm code below. Just remember that if you use a different game object for your second PlayerFist sprite to change the value accordingly.
Looks like I once again am using a module nobody else seems to be using. So, I discovered when using the Brawler Module that regardless of whether the player is facing left or right, the weapon sprite (in the tutorial's case, a PlayerFist) doesn't flip orientation. The result is that one of the attack directions is going to have a backwards PlayerFist. If you look closely at the tutorial videos, you'll see this is happening, but Joe doesn't notice. Easy oversight.
There are probably many ways to fix this, but I simply went into the ChangeToAttack_BrawlerBase.asm and changed the two instances of Weapon_Object into Weapon_Object1 and Weapon_Object2. I kept Weapon_Object1 = #$01 (the tutorial PlayerFist) and simply updated the Weapon_Object in the +notRight section to Weapon_Object1.
I used game object #$08 for a dedicated right-oriented PlayerFist, so I made Weapon_Object2 = #$08. I then updated the Weapon_Object when facing right to Weapon_Object2.
There is probably a way to make it work as intended (the game object sprite in #$01 simply flipping between left and right animations depending on player orientation, but I couldn't figure it out. This method does waste a game object spot, so it's not ideal, but for newbies wanting a basic functioning attack that displays the right oriented sprite, this is an easy fix. I'll paste the full ChangeToAttack_BrawlerBase.asm code below. Just remember that if you use a different game object for your second PlayerFist sprite to change the value accordingly.
Code:
;; if you would like unlockable weapons,
;; that will be created with the b button
;; use this code.
TXA
STA temp ;; assumes the object that we want is in x.
GetActionStep temp
CMP #$02 ;; is it already attacking?
BNE +canAttack
;; wait until we're back to idle to attack again.
RTS
+canAttack
ChangeActionStep temp, #$02 ;; assumes that "attack" is in action 2
;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_OBJECT1 = #$01 ;; this will display the sprite in the second game object slot
WEAPON_OBJECT2 = #$08 ;; this will display the sprite in the ninth game object slot
WEAPON_RIGHT_STATE = #$00
WEAPON_LEFT_STATE = #$00
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 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_OBJECT2
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_OBJECT1
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