Wolfos: refactor animation handling and streamline movement logic
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
; =========================================================
|
; =========================================================
|
||||||
; Wolfos Sprite Properties
|
; Wolfos Sprite Properties
|
||||||
; =========================================================
|
|
||||||
|
|
||||||
!SPRID = Sprite_Wolfos
|
!SPRID = Sprite_Wolfos
|
||||||
!NbrTiles = 03 ; Number of tiles used in a frame
|
!NbrTiles = 03 ; Number of tiles used in a frame
|
||||||
@@ -31,8 +30,6 @@
|
|||||||
!Boss = 00 ; 00 = normal sprite, 01 = sprite is a boss
|
!Boss = 00 ; 00 = normal sprite, 01 = sprite is a boss
|
||||||
%Set_Sprite_Properties(Sprite_Wolfos_Prep, Sprite_Wolfos_Long)
|
%Set_Sprite_Properties(Sprite_Wolfos_Prep, Sprite_Wolfos_Long)
|
||||||
|
|
||||||
; =========================================================
|
|
||||||
|
|
||||||
Sprite_Wolfos_Long:
|
Sprite_Wolfos_Long:
|
||||||
{
|
{
|
||||||
PHB : PHK : PLB
|
PHB : PHK : PLB
|
||||||
@@ -60,8 +57,6 @@ Sprite_Wolfos_CheckIfDefeated:
|
|||||||
RTS
|
RTS
|
||||||
}
|
}
|
||||||
|
|
||||||
; =========================================================
|
|
||||||
|
|
||||||
Sprite_Wolfos_Prep:
|
Sprite_Wolfos_Prep:
|
||||||
{
|
{
|
||||||
PHB : PHK : PLB
|
PHB : PHK : PLB
|
||||||
@@ -77,34 +72,41 @@ Sprite_Wolfos_Prep:
|
|||||||
LDA.b #$82 : STA.w SprDefl, X ; persist, impervious to arrows
|
LDA.b #$82 : STA.w SprDefl, X ; persist, impervious to arrows
|
||||||
LDA.b #$08 : STA.w SprNbrOAM, X ; Nbr Oam Entries
|
LDA.b #$08 : STA.w SprNbrOAM, X ; Nbr Oam Entries
|
||||||
STZ.w SprMiscG, X
|
STZ.w SprMiscG, X
|
||||||
|
STZ.w SprMiscE, X
|
||||||
PLB
|
PLB
|
||||||
RTL
|
RTL
|
||||||
}
|
}
|
||||||
|
|
||||||
; =========================================================
|
Wolfos_AnimateAction = SprMiscE
|
||||||
|
|
||||||
macro AttackForward()
|
macro AttackForward()
|
||||||
%GotoAction($00)
|
%GotoAction($00)
|
||||||
|
STA.w Wolfos_AnimateAction, X
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
macro AttackBack()
|
macro AttackBack()
|
||||||
%GotoAction($01)
|
%GotoAction($01)
|
||||||
|
STA.w Wolfos_AnimateAction, X
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
macro WalkRight()
|
macro WalkRight()
|
||||||
%GotoAction($02)
|
%GotoAction($02)
|
||||||
|
STA.w Wolfos_AnimateAction, X
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
macro WalkLeft()
|
macro WalkLeft()
|
||||||
%GotoAction($03)
|
%GotoAction($03)
|
||||||
|
STA.w Wolfos_AnimateAction, X
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
macro AttackRight()
|
macro AttackRight()
|
||||||
%GotoAction($04)
|
%GotoAction($04)
|
||||||
|
STA.w Wolfos_AnimateAction, X
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
macro AttackLeft()
|
macro AttackLeft()
|
||||||
%GotoAction($05)
|
%GotoAction($05)
|
||||||
|
STA.w Wolfos_AnimateAction, X
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
macro Subdued()
|
macro Subdued()
|
||||||
@@ -124,6 +126,8 @@ endmacro
|
|||||||
|
|
||||||
Sprite_Wolfos_Main:
|
Sprite_Wolfos_Main:
|
||||||
{
|
{
|
||||||
|
JSR Sprite_Wolfos_Animate
|
||||||
|
|
||||||
LDA.w SprAction, X
|
LDA.w SprAction, X
|
||||||
JSL JumpTableLocal
|
JSL JumpTableLocal
|
||||||
|
|
||||||
@@ -139,75 +143,59 @@ Sprite_Wolfos_Main:
|
|||||||
|
|
||||||
Wolfos_AttackForward:
|
Wolfos_AttackForward:
|
||||||
{
|
{
|
||||||
%PlayAnimation(0, 2, 10)
|
|
||||||
JSR Wolfos_Move
|
JSR Wolfos_Move
|
||||||
JSR Wolfos_DecideAction
|
|
||||||
%SetSpriteSpeedY(!NormalSpeed)
|
|
||||||
%SetTimerA($30)
|
|
||||||
RTS
|
RTS
|
||||||
}
|
}
|
||||||
|
|
||||||
Wolfos_AttackBack:
|
Wolfos_AttackBack:
|
||||||
{
|
{
|
||||||
%PlayAnimation(3, 5, 10)
|
|
||||||
JSR Wolfos_Move
|
JSR Wolfos_Move
|
||||||
%SetSpriteSpeedY(-!NormalSpeed)
|
|
||||||
%SetTimerA($30)
|
|
||||||
RTS
|
RTS
|
||||||
}
|
}
|
||||||
|
|
||||||
Wolfos_WalkRight:
|
Wolfos_WalkRight:
|
||||||
{
|
{
|
||||||
%StartOnFrame(6)
|
|
||||||
%PlayAnimation(6, 8, 10)
|
|
||||||
JSR Wolfos_Move
|
JSR Wolfos_Move
|
||||||
LDA #!NormalSpeed : STA.w SprXSpeed, X
|
|
||||||
STZ.w SprYSpeed, X
|
|
||||||
|
|
||||||
JSL GetRandomInt : AND.b #$3F : BNE +
|
JSL GetRandomInt : AND.b #$3F : BNE +
|
||||||
|
LDA #!AttackSpeed : STA.w SprXSpeed, X
|
||||||
|
%SetImpervious(1)
|
||||||
%AttackRight()
|
%AttackRight()
|
||||||
+
|
|
||||||
%SetTimerA($30)
|
%SetTimerA($30)
|
||||||
|
+
|
||||||
RTS
|
RTS
|
||||||
}
|
}
|
||||||
|
|
||||||
Wolfos_WalkLeft:
|
Wolfos_WalkLeft:
|
||||||
{
|
{
|
||||||
%StartOnFrame(9)
|
|
||||||
%PlayAnimation(9, 11, 10)
|
|
||||||
JSR Wolfos_Move
|
JSR Wolfos_Move
|
||||||
LDA #-!NormalSpeed : STA.w SprXSpeed, X
|
|
||||||
STZ.w SprYSpeed, X
|
|
||||||
|
|
||||||
JSL GetRandomInt : AND.b #$3F : BNE +
|
JSL GetRandomInt : AND.b #$3F : BNE +
|
||||||
|
LDA #-!AttackSpeed : STA.w SprXSpeed, X
|
||||||
|
%SetImpervious(1)
|
||||||
%AttackLeft()
|
%AttackLeft()
|
||||||
+
|
+
|
||||||
%SetTimerA($30)
|
|
||||||
RTS
|
RTS
|
||||||
}
|
}
|
||||||
|
|
||||||
Wolfos_AttackRight:
|
Wolfos_AttackRight:
|
||||||
{
|
{
|
||||||
%StartOnFrame(12)
|
|
||||||
%PlayAnimation(12, 13, 10)
|
|
||||||
LDA.w SprGfxProps, X : ORA.b #$40 : STA.w SprGfxProps, X
|
|
||||||
JSL Sprite_Move
|
JSL Sprite_Move
|
||||||
LDA #!AttackSpeed : STA.w SprXSpeed, X
|
JSL Sprite_DamageFlash_Long
|
||||||
|
JSL Sprite_CheckDamageFromPlayer
|
||||||
LDA.w SprTimerA, X : BNE +
|
LDA.w SprTimerA, X : BNE +
|
||||||
LDA.w SprGfxProps, X : AND.b #$40 : STA.w SprGfxProps, X
|
|
||||||
%WalkRight()
|
%WalkRight()
|
||||||
|
%SetImpervious(0)
|
||||||
+
|
+
|
||||||
RTS
|
RTS
|
||||||
}
|
}
|
||||||
|
|
||||||
Wolfos_AttackLeft:
|
Wolfos_AttackLeft:
|
||||||
{
|
{
|
||||||
%StartOnFrame(14)
|
|
||||||
%PlayAnimation(14, 15, 10)
|
|
||||||
JSL Sprite_Move
|
JSL Sprite_Move
|
||||||
LDA #-!AttackSpeed : STA.w SprXSpeed, X
|
JSL Sprite_DamageFlash_Long
|
||||||
|
JSL Sprite_CheckDamageFromPlayer
|
||||||
LDA.w SprTimerA, X : BNE +
|
LDA.w SprTimerA, X : BNE +
|
||||||
%WalkLeft()
|
%WalkLeft()
|
||||||
|
%SetImpervious(0)
|
||||||
+
|
+
|
||||||
RTS
|
RTS
|
||||||
}
|
}
|
||||||
@@ -254,8 +242,7 @@ Sprite_Wolfos_Main:
|
|||||||
|
|
||||||
Wolfos_Dismiss:
|
Wolfos_Dismiss:
|
||||||
{
|
{
|
||||||
STZ.w SprXSpeed, X
|
STZ.w SprXSpeed, X : STZ.w SprYSpeed, X
|
||||||
STZ.w SprYSpeed, X
|
|
||||||
|
|
||||||
LDA.w SprTimerD, X : BNE .dismiss
|
LDA.w SprTimerD, X : BNE .dismiss
|
||||||
LDA.b #$00 : STA.w SprState, X ; kill sprite normal style
|
LDA.b #$00 : STA.w SprState, X ; kill sprite normal style
|
||||||
@@ -268,6 +255,65 @@ Sprite_Wolfos_Main:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Sprite_Wolfos_Animate:
|
||||||
|
{
|
||||||
|
LDA.w Wolfos_AnimateAction, X : JSL JumpTableLocal
|
||||||
|
|
||||||
|
dw Wolfos_Animate_AttackForward ; 0x00
|
||||||
|
dw Wolfos_Animate_AttackBack ; 0x01
|
||||||
|
dw Wolfos_Animate_WalkRight ; 0x02
|
||||||
|
dw Wolfos_Animate_WalkLeft ; 0x03
|
||||||
|
dw Wolfos_Animate_AttackRight ; 0x04
|
||||||
|
dw Wolfos_Animate_AttackLeft ; 0x05
|
||||||
|
dw Wolfos_Animate_Subdued ; 0x06
|
||||||
|
|
||||||
|
Wolfos_Animate_AttackForward:
|
||||||
|
{
|
||||||
|
%PlayAnimation(0, 2, 10)
|
||||||
|
RTS
|
||||||
|
}
|
||||||
|
|
||||||
|
Wolfos_Animate_AttackBack:
|
||||||
|
{
|
||||||
|
%PlayAnimation(3, 5, 10)
|
||||||
|
RTS
|
||||||
|
}
|
||||||
|
|
||||||
|
Wolfos_Animate_WalkRight:
|
||||||
|
{
|
||||||
|
%StartOnFrame(6)
|
||||||
|
%PlayAnimation(6, 8, 10)
|
||||||
|
RTS
|
||||||
|
}
|
||||||
|
|
||||||
|
Wolfos_Animate_WalkLeft:
|
||||||
|
{
|
||||||
|
%StartOnFrame(9)
|
||||||
|
%PlayAnimation(9, 11, 10)
|
||||||
|
RTS
|
||||||
|
}
|
||||||
|
|
||||||
|
Wolfos_Animate_AttackRight:
|
||||||
|
{
|
||||||
|
%StartOnFrame(12)
|
||||||
|
%PlayAnimation(12, 13, 10)
|
||||||
|
RTS
|
||||||
|
}
|
||||||
|
|
||||||
|
Wolfos_Animate_AttackLeft:
|
||||||
|
{
|
||||||
|
%StartOnFrame(14)
|
||||||
|
%PlayAnimation(14, 15, 10)
|
||||||
|
RTS
|
||||||
|
}
|
||||||
|
|
||||||
|
Wolfos_Animate_Subdued:
|
||||||
|
{
|
||||||
|
%PlayAnimation(0, 0, 10)
|
||||||
|
RTS
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Wolfos_Move:
|
Wolfos_Move:
|
||||||
{
|
{
|
||||||
JSL Sprite_DamageFlash_Long
|
JSL Sprite_DamageFlash_Long
|
||||||
@@ -284,6 +330,8 @@ Wolfos_Move:
|
|||||||
|
|
||||||
Wolfos_DecideAction:
|
Wolfos_DecideAction:
|
||||||
{
|
{
|
||||||
|
JSR Wolfos_MoveAction_Basic
|
||||||
|
|
||||||
LDA.w SprTimerA, X : BNE .decide_new_action
|
LDA.w SprTimerA, X : BNE .decide_new_action
|
||||||
JSL GetRandomInt : AND #$02 : STA.w SprMiscG, X
|
JSL GetRandomInt : AND #$02 : STA.w SprMiscG, X
|
||||||
RTS
|
RTS
|
||||||
@@ -313,17 +361,26 @@ Wolfos_MoveAction_Basic:
|
|||||||
|
|
||||||
.adjust_y
|
.adjust_y
|
||||||
JSL Sprite_IsBelowPlayer : TYA : BEQ .above_player
|
JSL Sprite_IsBelowPlayer : TYA : BEQ .above_player
|
||||||
|
%SetSpriteSpeedY(-!NormalSpeed)
|
||||||
|
%SetTimerA($30)
|
||||||
%AttackBack()
|
%AttackBack()
|
||||||
RTS
|
RTS
|
||||||
.above_player
|
.above_player
|
||||||
|
%SetSpriteSpeedY(!NormalSpeed)
|
||||||
|
%SetTimerA($30)
|
||||||
%AttackForward()
|
%AttackForward()
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
.adjust_x
|
.adjust_x
|
||||||
JSL Sprite_IsToRightOfPlayer : TYA : BEQ .right
|
JSL Sprite_IsToRightOfPlayer : TYA : BEQ .right
|
||||||
|
LDA #-!NormalSpeed : STA.w SprXSpeed, X
|
||||||
|
STZ.w SprYSpeed, X
|
||||||
|
%SetTimerA($30)
|
||||||
%WalkLeft()
|
%WalkLeft()
|
||||||
RTS
|
RTS
|
||||||
.right
|
.right
|
||||||
|
LDA #!NormalSpeed : STA.w SprXSpeed, X
|
||||||
|
STZ.w SprYSpeed, X
|
||||||
%WalkRight()
|
%WalkRight()
|
||||||
RTS
|
RTS
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user