Format movement and random attack code

This commit is contained in:
scawful
2024-03-30 11:52:20 -04:00
parent 8c0dc13f1f
commit 4b727b870d

View File

@@ -265,14 +265,15 @@ RandomlyAttack:
LDA #$CF LDA #$CF
JSL Sprite_SpawnDynamically JSL Sprite_SpawnDynamically
JSL Sprite_SetSpawnedCoords JSL Sprite_SetSpawnedCoords
;JSL $09B020 ;JSL $09B020 ; Fireball_SpawnTrailGarnish
LDA.b #$02 : STA $0D80, Y LDA.b #$02 : STA.w SprAction, Y
LDA #$10 : STA.w SprTimerA, Y LDA #$10 : STA.w SprTimerA, Y
.no_attack .no_attack
RTS RTS
} }
; =========================================================
Offspring1_Neck1_X = $19EA Offspring1_Neck1_X = $19EA
Offspring1_Neck2_X = $19EC Offspring1_Neck2_X = $19EC
Offspring1_Neck3_X = $19EE Offspring1_Neck3_X = $19EE
@@ -331,6 +332,10 @@ MoveWithBody:
RTS RTS
} }
; =========================================================
; Adjusts the movement speed of the sprite based on its
; position. This came from Zarby's Gleeok code and causes
; some weird movement with the current implementation.
AdjustMovementSpeed: AdjustMovementSpeed:
{ {
@@ -339,24 +344,20 @@ AdjustMovementSpeed:
LDA #-8 : STA.w SprXSpeed, X LDA #-8 : STA.w SprXSpeed, X
.biggerthanorigin .biggerthanorigin
LDA.w SprX, X : CLC : ADC #$16 ; X+32 LDA.w SprX, X : CLC : ADC #$16 ; X+32
CMP.w SprMiscA, X : BCS .lowerthanorigin CMP.w SprMiscA, X : BCS .lowerthanorigin
LDA #$08 : STA.w SprXSpeed, X LDA #$08 : STA.w SprXSpeed, X
.lowerthanorigin .lowerthanorigin
LDA.w SprY, X : SEC : SBC #$00 ; X-32 LDA.w SprY, X : SEC : SBC #$00 ; X-32
CMP.w SprMiscB, X : BCC .biggerthanorigin2 CMP.w SprMiscB, X : BCC .biggerthanorigin2
LDA #-8 : STA.w SprYSpeed, X LDA #-8 : STA.w SprYSpeed, X
.biggerthanorigin2 .biggerthanorigin2
LDA.w SprY, X : CLC : ADC #$20 ; X+32 LDA.w SprY, X : CLC : ADC #$20 ; X+32
CMP.w SprMiscB, X : BCS .lowerthanorigin2 CMP.w SprMiscB, X : BCS .lowerthanorigin2
LDA #$08 : STA.w SprYSpeed, X LDA #$08 : STA.w SprYSpeed, X
.lowerthanorigin2 .lowerthanorigin2
RTS RTS
} }