aboutsummaryrefslogtreecommitdiff
path: root/space/src/space.s
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <msabate@suse.com>2023-11-12 09:39:05 +0100
committerMiquel Sabaté Solà <mikisabate@gmail.com>2025-02-04 21:02:11 +0100
commitdb9cb2118e7b2575ed3b0f535e50dd85c24df25a (patch)
tree8bfe1a7e48bd85e2e9ab0c650c248a7bed1955b7 /space/src/space.s
parentcb854722b9890c171f7d0600812a7e9a3a2a25c9 (diff)
downloadcode.nes-db9cb2118e7b2575ed3b0f535e50dd85c24df25a.tar.gz
code.nes-db9cb2118e7b2575ed3b0f535e50dd85c24df25a.zip
space: Simplify the code and its goals
Originally this was supposed to be a sort of mini game, but that would have probably made it too complex for newcomers. Thus, let's just keep it to subpixel movement and shooting bullets, which is already a big step from the `basics/sprite.s` example. Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to 'space/src/space.s')
-rw-r--r--space/src/space.s30
1 files changed, 9 insertions, 21 deletions
diff --git a/space/src/space.s b/space/src/space.s
index eec893c..f2c5dbe 100644
--- a/space/src/space.s
+++ b/space/src/space.s
@@ -1,23 +1,14 @@
;;;
-;;; TODO: reduce the scope of this to just:
-;;; - Movement through subpixels.
-;;; - Shooting (no collision or anything)
-;;; -> link to jetpac.nes for more stuff
-;;;
-;; This is similar to the sprite.s example, but it expands on it greatly into a
-;; full game by:
-;; - Having a moving background.
+;; This is similar to the basics/sprite.s example, but it expands a bit on it
+;; by:
;; - The ship can be moved:
;; - The movement is done through subpixels for a smoother experience.
;; - The ship's sprites are updated accordingly: resting, acceleration, full
;; speed.
-;; - Random asteroids will appear from time to time and they can collide with
-;; the ship:
-;; - A collision decreases the live status from the ship (cracks will appear
-;; to the sprite).
-;; - When the live status reaches 0 -> game over.
-;; - The ship can shoot and destroy asteroids.
-;; - There is a score.
+;; - The ship can shoot
+;;
+;; The subpixel movement is largely based on:
+;; https://github.com/NesHacker/PlatformerMovement.
;;;
.segment "HEADER"
@@ -48,6 +39,7 @@
.include "states/game.s"
.include "states/player.s"
+.include "states/bullets.s"
.include "vectors/reset.s"
.include "vectors/nmi.s"
.include "vectors/irq.s"
@@ -62,12 +54,7 @@
jsr init_palettes
jsr init_nametable
jsr Player::init
-
- ;; Reset scroll.
- bit PPU::STATUS
- lda #$00
- sta PPU::SCROLL
- sta PPU::SCROLL
+ jsr Bullets::init
cli
@@ -85,6 +72,7 @@
jsr Joypad::read
jsr Player::Movement::update
jsr Player::Sprite::update
+ jsr Bullets::update
;; This is a hand-shake between the code on `main` and the code on the
;; `nmi`. See Game::flags for more.