LDA gameHandler
AND #%00100000
BEQ notNPCstate_proj
JMP doneShooting
notNPCstate_proj
LDA weaponsUnlocked
AND #%00000010
BNE canShoot
JMP doneShooting
canShoot:
LDX player1_object
GetCurrentActionType player1_object
CMP #$02
BNE notAlreadyShooting
JMP doneShooting
notAlreadyShooting
;;; don't attack if already attacking.
;;; do we have to check for hurt here?
;;;;; Here, we WOULD create melee
ChangeObjectState #$02, #$02
LDA Object_movement,x
AND #%00001111
STA Object_movement,x
LDA #$00
STA Object_h_speed_hi,x
STA Object_h_speed_lo,x
STA Object_v_speed_hi,x
STA Object_v_speed_lo,x
LDA Object_x_hi,x
STA temp
LDA Object_y_hi,x
STA temp1
LDA Object_movement,x
AND #%00000111
STA temp2
CMP FACE_LEFT
BEQ setLEFTOffsetProjectile
CMP FACE_RIGHT
BEQ setRIGHTOffsetProjectile
CMP FACE_UP
BEQ setUPOffsetProjectile
CMP FACE_DOWN
BEQ setDOWNOffsetProjectile
JMP doneShooting
setLEFTOffsetProjectile:
LDA Object_x_hi,x
CLC
ADC #$04 ;;<<-- horizontal offset of your weapon when your player facing left (change the value to adjust)
STA temp
LDA Object_y_hi,x
CLC
ADC #$04 ;;<<-- horizontal offset of your weapon when your player facing left(change the value to adjust)
STA temp1
JMP continueCreatingProjectile
setRIGHTOffsetProjectile:
LDA Object_x_hi,x
CLC
ADC #$04 ;;<<-- horizontal offset of your weapon when your player facing right (change the value to adjust)
STA temp
LDA Object_y_hi,x
CLC
ADC #$04 ;;<<-- horizontal offset of your weapon when your player facing right (change the value to adjust)
STA temp1
JMP continueCreatingProjectile
setUPOffsetProjectile:
LDA Object_x_hi,x
CLC
ADC #$04 ;;<<-- horizontal offset of your weapon when your player facing up (change the value to adjust)
STA temp
LDA Object_y_hi,x
CLC
ADC #$04 ;;<<-- horizontal offset of your weapon when your player facing up (change the value to adjust)
STA temp1
JMP continueCreatingProjectile
setDOWNOffsetProjectile:
LDA Object_x_hi,x
CLC
ADC #$04 ;;<<-- horizontal offset of your weapon when your player facing down (change the value to adjust)
STA temp
LDA Object_y_hi,x
CLC
ADC #$04 ;;<<-- horizontal offset of your weapon when your player facing down (change the value to adjust)
STA temp1
JMP continueCreatingProjectile
continueCreatingProjectile:
CreateObject temp, temp1, #$03, #$00
;;;; x is now the newly created object's x.
LDA Object_movement,x
ORA temp2
STA Object_movement,x
LDY temp2
LDA directionTable,y
ORA Object_movement,x
STA Object_movement,x
PlaySound #sfx_shoot
doneShooting:
RTS