TolerantX
Active member
I tried dissecting the code and reassembling it to no ends trying to get the character to shoot left when facing left in the shooter module. I used scripts from the adventure and platformer modules but the shooting left doesn't work correctly when scrolling. the bullets spawn at awkward places. In my game it's like section Z where you shoot left with b and right with a, so when you read my script keep that in mind. I also limit my projectiles per screen and have it change the player to state 3 when they fire a shot... here's my script... in this it is correct except the player shoots RIGHT, not left.... in my script i need them to shoot left THANK YOU
Code:
LDX player1_object
GetCurrentActionType player1_object
FaceDirection player1_object, FACE_LEFT
CmP #$03
BNE notAlreadyShooting2
JMP doneShooting2
notAlreadyShooting2
;; UNCOMMENT 11-16 IF YOU WANT THE PLAYER TO STOP MOVING UPON ATTACK.
LDX player1_object ;; Now x is loaded with the player
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
ChangeObjectState #$03, #$02
LDA Object_movement,x
AND #%00000111 ;; this is now the "facing direction"
TAY ;; now it is loaded in y.
LDA weaponOffsetTableX,y
STA temp
LDA weaponOffsetTableY,y
STA temp1
LDA #%00000010
TAY ;; now y contains direction, so we can figure out position offset
LDA Object_x_hi,x
;;; offset x for creation
CLC
ADC weaponOffsetTableX,y
; SEC
; SBC xScroll
SEC
SBC #$08 ;; width of gun
STA temp
LDA Object_y_hi,x
CLC
ADC weaponOffsetTableY,y
sec
sbc #$08 ;; height of gun
STA temp1
LDA Object_scroll,x
STA temp2
;;We count the projectile already on screen to see if can Shoot another one :
CountObjects #%00000100, #$00 ;; count player weapon on screen
LDA monsterCounter ;; the variable used to count is monsterCounter
CLC
CMP #PROJECTILE_MAX ;; compare to 2
BCC + ;; if less than 2 on screen we can create a projectile
RTS ;; else we quit
+
CreateObject temp, temp1, #OBJECT_PLAYER_PROJECTILE, #$00, temp2
;;;; x is now the newly created object's x.
LDA #%11000010
STA Object_movement,x
PlaySound #SND_SHOOT
doneShooting2:
RTS