Add Piratian friendly and aggro behavior

This commit is contained in:
scawful
2025-01-19 12:34:53 -05:00
parent aef81e8032
commit 206993e3d5
8 changed files with 28 additions and 77 deletions

View File

@@ -1,8 +1,6 @@
; =========================================================
; Sprite Properties
; =========================================================
; Piratian
!SPRID = $0E ; The sprite ID you are overwriting (HEX)
!SPRID = $0E
!NbrTiles = 02 ; Number of tiles used in a frame
!Harmless = 00 ; 00 = Sprite is Harmful, 01 = Sprite is Harmless
!HVelocity = 00 ; Is your sprite going super fast? put 01 if it is
@@ -44,18 +42,15 @@ Sprite_Piratian_Long:
RTL
}
; =========================================================
Sprite_Piratian_Prep:
{
PHB : PHK : PLB
LDA.b #$08 : STA.w SprHealth, X
STZ.w SprMiscA, X
PLB
RTL
}
; =========================================================
Sprite_Piratian_Main:
{
JSR Sprite_Piratian_Move
@@ -67,10 +62,8 @@ Sprite_Piratian_Main:
dw Piratian_MoveUp
dw Piratian_MoveLeft
dw Piratian_MoveRight
dw SkullHead
Piratian_MoveDown:
{
%PlayAnimation(0,1,16)
@@ -119,68 +112,32 @@ Sprite_Piratian_Move:
JSL ThrownSprite_TileAndSpriteInteraction_long
JSL Sprite_CheckDamageFromPlayer : BCC .no_dano
LDA.b #$01 : STA.w SprMiscA, X
%SetTimerA($60)
%SetTimerF($20)
.no_dano
LDA.w SprMiscA, X : BEQ .no_aggro
JSL Sprite_ProjectSpeedTowardsPlayer
JSL Sprite_CheckDamageToPlayer
JMP .return
.no_aggro
JSR Sprite_Pirate_Friendly
.return
RTS
}
; =========================================================
Sprite_Piratian_Friendly:
{
%ShowSolicitedMessage($01BB)
RTS
}
Sprite_Piratian_Draw:
{
JSL Sprite_PrepOamCoord
JSL Sprite_OAM_AllocateDeferToPlayer
%DrawSprite()
LDA.w SprFrame, X : TAY ;Animation Frame
LDA .start_index, Y : STA $06
PHX
LDX .nbr_of_tiles, Y ;amount of tiles -1
LDY.b #$00
.nextTile
PHX ; Save current Tile Index?
TXA : CLC : ADC $06 ; Add Animation Index Offset
PHA ; Keep the value with animation index offset?
ASL A : TAX
REP #$20
LDA $00 : CLC : ADC .x_offsets, X : STA ($90), Y
AND.w #$0100 : STA $0E
INY
LDA $02 : CLC : ADC .y_offsets, X : STA ($90), Y
CLC : ADC #$0010 : CMP.w #$0100
SEP #$20
BCC .on_screen_y
LDA.b #$F0 : STA ($90), Y ;Put the sprite out of the way
STA $0E
.on_screen_y
PLX ; Pullback Animation Index Offset (without the *2 not 16bit anymore)
INY
LDA .chr, X : STA ($90), Y
INY
LDA .properties, X : STA ($90), Y
PHY
TYA : LSR #2 : TAY
LDA .sizes, X : ORA $0F : STA ($92), Y ; store size in oam buffer
PLY : INY
PLX : DEX : BPL .nextTile
PLX
RTS
; =========================================================
.start_index
db $00, $01, $02, $03, $04, $05, $06, $07, $08, $09
.nbr_of_tiles