warpedpipe
New member
How would I go about adding the ability for an enemy to shoot a projectile using the MetroidVania module? I dont recall seeing any tutorials on making enemies shoot.
Here's an AI script you can use for an Enemy Shoot action:How would I go about adding the ability for an enemy to shoot a projectile using the MetroidVania module? I dont recall seeing any tutorials on making enemies shoot.
;;; Monster shoot
CountObjects #%00010000
CMP #2 ;Limit projectiles
BCC +doEnemyShoot
JMP +skipEnemyShoot
+doEnemyShoot
LDA Object_x_hi,x
CLC
ADC #4 ;Offset
STA tempA
LDA Object_screen,x
STA tempC
LDA Object_y_hi,x
CLC
ADC #4 ;Offset
STA tempB
LDA Object_direction,x
AND #%00000111
STA tempD
TXA
PHA
CreateObjectOnScreen tempA, tempB, #10, #0, tempC ;;; #10 is the game object used
;;; as an enemy projectile in
;;; this example.
;;; x, y, object, starting action.
;;; and now with that object, copy the player's
;;; direction and start it moving that way.
LDA tempD
STA Object_direction,x
TAY
LDA DirectionTableOrdered,y
STA temp1
STX temp
StartMoving temp, temp1
PLA
TAX
+skipEnemyShoot