From 95190dda3c994e63475654ce02c1216fe8e933ea Mon Sep 17 00:00:00 2001 From: scawful Date: Fri, 14 Jun 2024 21:43:36 -0400 Subject: [PATCH] update thunder ghost movement AI --- Sprites/Enemies/thunder_ghost.asm | 67 +++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 3 deletions(-) diff --git a/Sprites/Enemies/thunder_ghost.asm b/Sprites/Enemies/thunder_ghost.asm index 11f77b1..8cd1817 100644 --- a/Sprites/Enemies/thunder_ghost.asm +++ b/Sprites/Enemies/thunder_ghost.asm @@ -64,13 +64,74 @@ Sprite_ThunderGhost_Main: { LDA.w SprAction, X JSL UseImplicitRegIndexedLocalJumpTable - dw ThunderGhostHandler + + dw ThunderGhostFaceForward + dw ThunderGhostLeft + dw ThunderGhostRight + dw CastThunderLeft + dw CastThunderRight - ThunderGhostHandler: + ThunderGhostFaceForward: { - %PlayAnimation(0, 7, 16) + %PlayAnimation(0, 1, 16) + JSR Sprite_ThunderGhost_Move + RTS + } + ThunderGhostLeft: + { + %PlayAnimation(2, 3, 16) + JSR Sprite_ThunderGhost_Move + RTS + } + + ThunderGhostRight: + { + %PlayAnimation(4, 5, 16) + JSR Sprite_ThunderGhost_Move + RTS + } + + CastThunderLeft: + { + %PlayAnimation(6, 6, 16) + RTS + } + + CastThunderRight: + { + %PlayAnimation(7, 7, 16) + RTS + } +} + + +Sprite_ThunderGhost_Move: +{ + JSL Sprite_Move + JSL Sprite_BounceFromTileCollision + JSL Sprite_PlayerCantPassThrough + + JSL Sprite_IsToRightOfPlayer : CPY.b #$01 : BNE .ToRight + %GotoAction(1) + JMP .Continue + .ToRight + %GotoAction(2) + .Continue + + LDA.w SprMiscB, X + JSL UseImplicitRegIndexedLocalJumpTable + + dw ThunderGhostMove + + ThunderGhostMove: + { + JSL GetRandomInt : AND.b #$06 + JSL Sprite_FloatTowardPlayer + + JSL Sprite_CheckDamageFromPlayer + JSL Sprite_CheckDamageToPlayer RTS }