crazygrouptrio
Active member
As stated on the facebook page (but reiterated here if it helps someone in the future) monsters are not getting hit by my projectile at irregular intervals. Some get hit, some don't, depending on when the monster enters the screen via scrolling.
Here is my projectile script (Fair warning, the script is a mess, and it has 4 different functioning projectile scripts and I haven't condensed it down yet). Also the script works fine other than in this instance. It works 100% fine on non-scrolling screens.
Thanks in advance Dale Coop lol :lol:
Here is my projectile script (Fair warning, the script is a mess, and it has 4 different functioning projectile scripts and I haven't condensed it down yet). Also the script works fine other than in this instance. It works 100% fine on non-scrolling screens.
Code:
; load the player1_object (current inputs):
;JSR Player1objectInputs
;; if on a cutscene:
;LDA screenFlags
; AND #%00000010
; BEQ +
; RTS
; +
LDA isPaused
BEQ +
RTS
+
LDX player1_object
LDA Object_physics_byte,x
AND #%00000001 ;; is on ground
BNE +
JMP doneAttacking
+
LDA gameHandler
AND #%00100000
BEQ canAttack
JMP doneAttacking
;notNPCstate_spriteweapon:
;LDA weaponsUnlocked
; AND #%00000001
; BNE canAttack
;JMP doneAttacking
canAttack:
LDA gamepad
AND #%00100000 ; if down is pressed
BNE +
JMP doNormalAttack
+
JMP doCrouchAttack
doNormalAttack:
GetCurrentActionType player1_object
CMP #$06
BNE +
JMP doneAttacking
+
GetCurrentActionType player1_object
CMP #$05
BNE +
JMP combo3
+
GetCurrentActionType player1_object
CMP #$04
BNE +
JMP combo2
+
GetCurrentActionType player1_object
CMP #$01
BEQ +
JMP combo1
+
GetCurrentActionType player1_object
CMP #$02
BEQ +
JMP doneAttacking
+
RTS
combo1:
;;; don't attack if already attacking.
;;; do we have to check for hurt here?
;;;;; Here, we WOULD create melee
ChangeObjectState #$04, #$02
;;; if you want your player stops when he's shooting, comment out the following lines:
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
;; if was already shooting
wasAlreadyShooting:
LDA Object_movement,x
AND #%00000111
STA temp2
CMP #%00000110
BEQ setLEFTOffsetProjectile
CMP #%00000010
BEQ setRIGHTOffsetProjectile
CMP #%00000100
JMP doneAttacking
setLEFTOffsetProjectile:
LDA Object_x_hi,x
CLC
SBC #$08 ;;<<-- horizontal offset of your weapon when your player facing left (change the value to adjust from #$00 to #$0F or more)
STA temp
LDA Object_y_hi,x
CLC
ADC #$08 ;;<<-- vertical offset of your weapon when your player facing left(change the value to adjust from #$00 to #$0F or more)
STA temp1
JMP continueCreatingSpecial
setRIGHTOffsetProjectile:
LDA Object_x_hi,x
CLC
ADC #$11 ;;<<-- horizontal offset of your weapon when your player facing right (change the value to adjust from #$00 to #$0F or more)
STA temp
LDA Object_y_hi,x
CLC
ADC #$08 ;;<<-- vertical offset of your weapon when your player facing right (change the value to adjust from #$00 to #$0F or more)
STA temp1
JMP continueCreatingSpecial
continueCreatingSpecial:
CreateObject temp, temp1, #$01, #$00, currentNametable
;DEC limitProjectile
;;;; 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
RTS
combo2:
ChangeObjectState #$05, #$02
;;; don't attack if already attacking.
;;; do we have to check for hurt here?
;;;;; Here, we WOULD create melee
; ChangeObjectState #$04, #$02
;;; if you want your player stops when he's shooting, comment out the following lines:
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
;; if was already shooting
wasAlreadyShooting2:
LDA Object_movement,x
AND #%00000111
STA temp2
CMP #%00000110
BEQ setLEFTOffsetProjectile2
CMP #%00000010
BEQ setRIGHTOffsetProjectile2
CMP #%00000100
JMP doneAttacking
setLEFTOffsetProjectile2:
LDA Object_x_hi,x
CLC
SBC #$08 ;;<<-- horizontal offset of your weapon when your player facing left (change the value to adjust from #$00 to #$0F or more)
STA temp
LDA Object_y_hi,x
CLC
ADC #$05 ;;<<-- vertical offset of your weapon when your player facing left(change the value to adjust from #$00 to #$0F or more)
STA temp1
JMP continueCreatingSpecial2
setRIGHTOffsetProjectile2:
LDA Object_x_hi,x
CLC
ADC #$11 ;;<<-- horizontal offset of your weapon when your player facing right (change the value to adjust from #$00 to #$0F or more)
STA temp
LDA Object_y_hi,x
CLC
ADC #$05 ;;<<-- vertical offset of your weapon when your player facing right (change the value to adjust from #$00 to #$0F or more)
STA temp1
JMP continueCreatingSpecial2
continueCreatingSpecial2:
CreateObject temp, temp1, #$01, #$00, currentNametable
;DEC limitProjectile
;;;; 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
RTS
JMP doneAttacking
combo3:
ChangeObjectState #$06, #$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
;; if was already shooting
;wasAlreadyShooting:
LDA Object_movement,x
AND #%00000111
STA temp2
CMP #%00000110
BEQ setLEFTOffsetProjectile3
CMP #%00000010
BEQ setRIGHTOffsetProjectile3
CMP #%00000100
JMP doneAttacking
setLEFTOffsetProjectile3:
LDA Object_x_hi,x
CLC
SBC #$08 ;;<<-- horizontal offset of your weapon when your player facing left (change the value to adjust from #$00 to #$0F or more)
STA temp
LDA Object_y_hi,x
CLC
ADC #$08 ;;<<-- vertical offset of your weapon when your player facing left(change the value to adjust from #$00 to #$0F or more)
STA temp1
JMP continueCreatingSpecial3
setRIGHTOffsetProjectile3:
LDA Object_x_hi,x
CLC
ADC #$11 ;;<<-- horizontal offset of your weapon when your player facing right (change the value to adjust from #$00 to #$0F or more)
STA temp
LDA Object_y_hi,x
CLC
ADC #$08 ;;<<-- vertical offset of your weapon when your player facing right (change the value to adjust from #$00 to #$0F or more)
STA temp1
JMP continueCreatingSpecial3
continueCreatingSpecial3:
CreateObject temp, temp1, #$03, #$00, currentNametable
;DEC limitProjectile
;;;; 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
RTS
doCrouchAttack:
GetCurrentActionType player1_object
CMP #$03
BNE +
JMP doneAttacking
+
ChangeObjectState #$03, #$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
;; if was already shooting
wasAlreadyShooting4:
LDA Object_movement,x
AND #%00000111
STA temp2
CMP #%00000110
BEQ setLEFTOffsetProjectile4
CMP #%00000010
BEQ setRIGHTOffsetProjectile4
CMP #%00000100
JMP doneAttacking
setLEFTOffsetProjectile4:
LDA Object_x_hi,x
CLC
SBC #$08 ;;<<-- horizontal offset of your weapon when your player facing left (change the value to adjust from #$00 to #$0F or more)
STA temp
LDA Object_y_hi,x
CLC
ADC #$0C ;;<<-- vertical offset of your weapon when your player facing left(change the value to adjust from #$00 to #$0F or more)
STA temp1
JMP continueCreatingSpecial4
setRIGHTOffsetProjectile4:
LDA Object_x_hi,x
CLC
ADC #$11 ;;<<-- horizontal offset of your weapon when your player facing right (change the value to adjust from #$00 to #$0F or more)
STA temp
LDA Object_y_hi,x
CLC
ADC #$0C ;;<<-- vertical offset of your weapon when your player facing right (change the value to adjust from #$00 to #$0F or more)
STA temp1
JMP continueCreatingSpecial4
continueCreatingSpecial4:
CreateObject temp, temp1, #$01, #$00, currentNametable
;DEC limitProjectile
;;;; 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
doneAttacking:
RTS