;; Nate's now slightly less-janky object parenting w/ melee weapon
GetCurrentActionType player1_weapon ;; Checking if the weapon is in action type 00...
CMP #$00
BEQ +++ ;; If so, skip this whole business...
LDX player1_object
LDA Object_animation_frame,x
STA temp
LDA Object_movement,x
AND #%00000111
STA temp3
TAY
CLC
CMP #$04 ;;If it if four or greater, you are facing right. (Some code taken from Dieting Hippo's melee script, checks which direction you are facing and draws the sprite accordingly)
BCS + ;; if carry flag is set, jump to our nameless label
LDA Object_x_hi,x
SEC
SBC #$00 ;; width of melee weapon (Right offset)
JMP ++ ; skip doing the left stuff
+
LDA Object_x_hi,x
SEC
SBC #$1F ;; width of melee weapon (Left offset)
++
CLC
ADC weaponOffsetTableX,y
STA temp1
LDA Object_y_hi,x
CLC
ADC weaponOffsetTableY,y
SEC
SBC #$08 ;; height of melee weapon
STA temp2
LDX player1_weapon
LDA temp1
STA Object_x_hi,x
LDA temp2
STA Object_y_hi,x
LDA Object_movement,x
ORA temp3
STA Object_movement,x
+++
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;