From 90267e4646234d464ee25b3d21fb6cb13217b9bb Mon Sep 17 00:00:00 2001 From: Lucas Scharenbroich Date: Sat, 20 Nov 2021 20:33:27 -0600 Subject: [PATCH] Test updating tile ID in UpdateSprite for a run sequence. --- demos/sprites/App.Main.s | 23 ++++++++++++++++++++--- src/Render.s | 8 +++----- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/demos/sprites/App.Main.s b/demos/sprites/App.Main.s index 6182ce4..0223382 100644 --- a/demos/sprites/App.Main.s +++ b/demos/sprites/App.Main.s @@ -411,8 +411,6 @@ UpdatePlayerLocal ; Simple updates with gravity and collisions. It's important that eveything in this ; subroutine be done against UpdatePlayerPos - stz tmp0 ; build up some flags - stz PlayerStanding lda PlayerYVel bmi :no_ground_check @@ -490,13 +488,32 @@ UpdatePlayerPos txa ora LastHFlip ora #SPRITE_ID - tax + sta SpriteFrame + +; If the player is standing and XVel != 0, pick a frame + lda PlayerStanding + beq :frame + lda PlayerXVel + beq :frame + + jsl GetVBLTicks + and #$0003 + inc + and #$0003 + asl + adc SpriteFrame + sta SpriteFrame +:frame + ldx SpriteFrame + lda PlayerID jsl UpdateSprite ; Change the tile ID and / or flags rts LastHFlip dw 0 +SpriteFrame ds 2 + ; X = coordinate ; Y = coordinate GetTileAt diff --git a/src/Render.s b/src/Render.s index 9285331..668fca6 100644 --- a/src/Render.s +++ b/src/Render.s @@ -78,9 +78,7 @@ _Render jsr _ApplyBG0XPosPre jsr _ApplyBG1XPosPre - nop jsr _RenderSprites ; Once the BG0 X and Y positions are committed, update sprite data - nop jsr _UpdateBG0TileMap ; and the tile maps. These subroutines build up a list of tiles jsr _UpdateBG1TileMap ; that need to be updated in the code field @@ -122,9 +120,9 @@ _Render ldy ScreenHeight jsr _BltRange - ldx #0 - ldy ScreenHeight - jsr _BltSCB +; ldx #0 +; ldy ScreenHeight +; jsr _BltSCB lda StartY ; Restore the fields back to their original state ldx ScreenHeight