;;; Create a Projectile.
;;; Assumes that the projectile you want to create is in GameObject Slot 01.
;; We count the projectiles already on screen to see if can Shoot another one :
CountObjects #%00000100, #$00 ;; count player weapon on screen ;; the variable used to count is monsterCounter
CLC
CMP #$01 ;; compare to 2
BCC +canShoot ;; if less than 2 on screen we can create a projectile
RTS ;; else we quit
+canShoot
;; else, the script continues:
PlaySound #sfx_laser
TXA
PHA
TYA
PHA
LDX player1_object
LDA Object_x_hi,x ; get player x coord
STA tempA
LDA Object_y_hi,x; get player y coord
STA tempB
LDA Object_screen,x
STA tempC
CreateObjectOnScreen tempA, tempB, #$03, #$00, tempC
;;; x, y, object, starting action.
;;; and now with that object, copy the player's
;;; direction and start it moving that way.
PLA
TAY
PLA
TAX
RTS