Adding Enemy Projectiles to MetroidVania 4.5.9

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.
 

tbizzle

Well-known member
Read through this tutorial. Pretty easy.

 

baardbi

Well-known 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:

Code:
;;; 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

And yes. You also need to do the thing tbizzle talked about, or else you wont be able to collide with the enemy weapons.
 
Top Bottom