Skip to content

Commit

Permalink
Hide objects properly
Browse files Browse the repository at this point in the history
  • Loading branch information
mibi88 committed May 22, 2024
1 parent 4c165ea commit 7998387
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@ A small NES game, heavily inspired by the chrome dino.
You can build it with `build.sh`
To build it and run it directly use `./build_and_run.sh`

Currently it may run a bit too fast on an NTSC NES.
It is made for PAL but it can also run on NTSC, your region gets detected on
reset.

Big thanks to Gros Chien, Fiskbit, sylvie, johnybot, TakuikaNinja and other
people on the Nesdev Discord and forum for helping me to fix bugs, improve it,
etc.
Binary file modified bin/dino.nes
Binary file not shown.
2 changes: 2 additions & 0 deletions inc/defs.inc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ PPUOAM = $4014

.define NTSCSPRITE #$0F

.define VOIDSPRITE #$FF

PLAYERX = $0207
PLAYERY = $0204
PLAYERTILE = $0205
Expand Down
12 changes: 12 additions & 0 deletions src/main.asm
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ OBJINITLOOP:
STA wait, Y
JSR RAND
LDX loopx
LDA VOIDSPRITE
STA OBJECTTILE, X
CPX BIRDSTART
BCC SETHEIGHT
LDA FLOOR
Expand Down Expand Up @@ -461,6 +463,12 @@ MOVEOBJLOOP:
STA wait, Y
JMP MOVELOOPEND
MOVE:
LDA OBJECTTILE, X
CMP VOIDSPRITE
BNE UPDATEX
LDA #$0C
STA OBJECTTILE, X
UPDATEX:
LDA OBJECTX, X
STA oldx
SEC
Expand All @@ -483,6 +491,8 @@ MOVECONTINUE:
STA wait, Y
JSR RAND
LDX loopx
LDA VOIDSPRITE
STA OBJECTTILE, X
CPX BIRDSTART
BCC MOVELOOPEND
LDA FLOOR
Expand Down Expand Up @@ -556,6 +566,8 @@ RESETTICK:
LDX BIRDSTART
BIRDLOOP:
LDY OBJECTTILE, X
CPY VOIDSPRITE
BEQ CONTINUEBIRDLOOP
LDA #$11
STA OBJECTTILE, X
CPY #$11
Expand Down

0 comments on commit 7998387

Please sign in to comment.