From 4075ed911c261baaa4282b0346ea920b2080bdb4 Mon Sep 17 00:00:00 2001 From: Lucas Scharenbroich Date: Mon, 22 Nov 2021 13:27:27 -0600 Subject: [PATCH] Use the 'f' key to have the SPRITE_HIDE flag set every other frame for a flashing effect --- demos/sprites/App.Main.s | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/demos/sprites/App.Main.s b/demos/sprites/App.Main.s index f2d8062..e92881d 100644 --- a/demos/sprites/App.Main.s +++ b/demos/sprites/App.Main.s @@ -163,6 +163,15 @@ EvtLoop eor vsync sta vsync :not_v + cmp #'f' + bne :not_f + lda SpriteToggle + eor #SPRITE_HIDE + sta SpriteToggle + bne :not_f + stz SpriteCount + +:not_f :no_key_down @@ -495,6 +504,10 @@ UpdatePlayerPos ora #SPRITE_ID sta SpriteFrame + lda SpriteCount + eor SpriteToggle + sta SpriteCount + ; If the player is standing and XVel != 0, pick a frame lda PlayerStanding beq :frame @@ -509,7 +522,9 @@ UpdatePlayerPos adc SpriteFrame sta SpriteFrame :frame - ldx SpriteFrame + lda SpriteFrame + ora SpriteCount + tax lda PlayerID jsl UpdateSprite ; Change the tile ID and / or flags @@ -518,6 +533,8 @@ UpdatePlayerPos LastHFlip dw 0 SpriteFrame ds 2 +SpriteCount dw 0 +SpriteToggle dw 0 ; X = coordinate ; Y = coordinate