diff options
| -rw-r--r-- | basics/sprite.s | 6 | ||||
| -rw-r--r-- | space/README.md | 10 | ||||
| -rw-r--r-- | space/src/space.s | 10 | ||||
| -rw-r--r-- | space/src/states/player.s | 2 |
4 files changed, 22 insertions, 6 deletions
diff --git a/basics/sprite.s b/basics/sprite.s index fc024f7..944c429 100644 --- a/basics/sprite.s +++ b/basics/sprite.s @@ -11,7 +11,10 @@ ;; but bear in mind that compilers like `cc65` (the one used here, which is the ;; most common) already provide a default configuration for the linker that ;; glues a set of pretty common defined named segments. You can read about this -;; in `cfg/nes.cfg` from inside your cc65 installation. +;; in `cfg/nes.cfg` from inside your cc65 installation. Otherwise, I have also +;; written linker configuration files for other examples: take a look, for +;; instance, at the `config/unrom.cfg` file, which is used by the +;; `basics/unrom.s` program. ;;; ;;; @@ -257,7 +260,6 @@ reset: dex bne @palettes_reset_loop - ;; At this point everything is clear and with a state we know, now we can ;; jump into our main subroutine and start loading sprites, palettes, etc.; ;; and start the game proper. diff --git a/space/README.md b/space/README.md new file mode 100644 index 0000000..8a0b451 --- /dev/null +++ b/space/README.md @@ -0,0 +1,10 @@ +## Space + +This is an evolution from the `basics/sprite.s` and `basics/input.s` examples. +That is, we are no longer just showing a sprite, but we also allow the player to +move it and shoot bullets according to the player's input. + +The movement is done by taking into consideration subpixels. For this, I have +taken most of the code/idea from [NES +Hacker](https://github.com/NesHacker/PlatformerMovement). Thus, this part is +mostly attributed to him. diff --git a/space/src/space.s b/space/src/space.s index f2c5dbe..c6d431f 100644 --- a/space/src/space.s +++ b/space/src/space.s @@ -5,7 +5,7 @@ ;; - The movement is done through subpixels for a smoother experience. ;; - The ship's sprites are updated accordingly: resting, acceleration, full ;; speed. -;; - The ship can shoot +;; - The ship can shoot bullets. ;; ;; The subpixel movement is largely based on: ;; https://github.com/NesHacker/PlatformerMovement. @@ -45,8 +45,8 @@ .include "vectors/irq.s" ;;; -;; This is our main subroutine, the reset procedure will call at the very end of -;; initializing the hardware. +;; This is our main subroutine, the reset procedure will call it at the very end +;; of initializing the hardware. ;;; .proc main ;; Before starting the game loop proper we initialize all our assets: load @@ -69,6 +69,10 @@ sta PPU::MASK @main_game_loop: + ;; The main game loop leverages the logic to different subroutines. In + ;; short: first of all update the values on the joypad, then update the + ;; player's movement and sprites, and finally update the bullets' + ;; creation/movement. jsr Joypad::read jsr Player::Movement::update jsr Player::Sprite::update diff --git a/space/src/states/player.s b/space/src/states/player.s index 29c1585..e03f54c 100644 --- a/space/src/states/player.s +++ b/space/src/states/player.s @@ -1,7 +1,7 @@ ;;; ;; Player state: movement, animation, etc. The following memory addresses are ;; reserved for the player: -;; -> $30-$3F: internal data. +;; -> $30-$38: internal data. ;; -> $0200-$0207: OAM data. ;;; .scope Player |
