add goriya boomerang subtype w basic velocity and damage

This commit is contained in:
scawful
2024-06-27 08:50:24 -04:00
parent 037d95c47d
commit 5bf0424913

View File

@@ -38,8 +38,13 @@ Sprite_Goriya_Long:
{
PHB : PHK : PLB
JSR Sprite_Goriya_Draw ; Call the draw code
LDA.w SprSubtype, X : BEQ +
JSR Sprite_Boomerang_Draw
JMP ++
+
JSR Sprite_Goriya_Draw
JSL Sprite_DrawShadow
++
JSL Sprite_CheckActive ; Check if game is not paused
BCC .SpriteIsNotActive ; Skip Main code is sprite is innactive
@@ -73,6 +78,7 @@ Sprite_Goriya_Main:
dw Goriya_WalkingDown
dw Goriya_WalkingLeft
dw Goriya_WalkingRight
dw BoomerangAttack
Goriya_WalkingUp:
{
@@ -101,6 +107,20 @@ Sprite_Goriya_Main:
JSR Sprite_Goriya_Move
RTS
}
BoomerangAttack:
{
%PlayAnimation(0, 3, 6)
JSL Sprite_PlayerCantPassThrough
JSL Sprite_CheckDamageToPlayer : BCC .no_dano
; TODO: Project speed back towards origin entity.
STZ.w SprState, X
.no_dano
LDA.b #$10
JSL Sprite_ApplySpeedTowardsPlayer
JSL Sprite_Move
RTS
}
}
GoriyaMovementSpeed = 10
@@ -139,6 +159,16 @@ Goriya_HandleTileCollision:
RTS
}
Goriya_BoomerangAttack:
{
LDA.b #$2C
JSL Sprite_SpawnDynamically : BMI +
LDA.b #$01 : STA.w SprSubtype, Y
LDA.b #$04 : STA.w SprAction, Y
+
RTS
}
Sprite_Goriya_Move:
{
JSL Sprite_Move
@@ -152,6 +182,10 @@ Sprite_Goriya_Move:
JSR Goriya_HandleTileCollision
JSL GetRandomInt : AND.b #$3F : BNE ++
JSR Goriya_BoomerangAttack
++
LDA.w SprTimerC, X : BNE +
JSL GetRandomInt : AND.b #$03
STA.w SprMiscB, X
@@ -306,13 +340,77 @@ Sprite_Goriya_Draw:
db $3D, $3D
db $7D, $7D
db $7D, $7D
.sizes
db $02, $02
db $02, $02
db $02, $02
db $02, $02
db $02, $02
db $02, $02
db $02, $02
db $02, $02
}
Sprite_Boomerang_Draw:
{
JSL Sprite_PrepOamCoord
JSL Sprite_OAM_AllocateDeferToPlayer
LDA $0DC0, X : CLC : ADC $0D90, 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 : STA ($90), Y
AND.w #$0100 : STA $0E
INY
LDA $02 : 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 #$02 : 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
.nbr_of_tiles
db 0, 0, 0, 0
.chr
db $26
db $26
db $26
db $26
.properties
db $32
db $B2
db $F2
db $72
}