diff --git a/galactic-armada/Makefile b/galactic-armada/Makefile index 57a416d0..e368f0c9 100644 --- a/galactic-armada/Makefile +++ b/galactic-armada/Makefile @@ -98,7 +98,7 @@ $(foreach i, $(ASMSOURCES_DIRS), $(eval $(call object-from-asm,$i))) # Link and build the final ROM. $(BINS): $(OBJS) | $(DSTDIR) - $(LINK) -o $@ $^ + $(LINK) -n $(DSTDIR)/$(PROJECTNAME).sym -o $@ $^ $(FIX) $(FIXFLAGS) $@ # Ensure directories for generated files exist. define ensure-directory diff --git a/galactic-armada/src/main/GalacticArmada.asm b/galactic-armada/src/main/GalacticArmada.asm index f71fce8e..a8c2cea5 100644 --- a/galactic-armada/src/main/GalacticArmada.asm +++ b/galactic-armada/src/main/GalacticArmada.asm @@ -29,7 +29,7 @@ EntryPoint: ; from: https://github.com/eievui5/gb-sprobj-lib ; The library is relatively simple to get set up. First, put the following in your initialization code: - ; Initilize Sprite Object Library. + ; Initialize Sprite Object Library. call InitSprObjLibWrapper ; Turn the LCD off diff --git a/galactic-armada/src/main/states/gameplay/gameplay-state.asm b/galactic-armada/src/main/states/gameplay/gameplay-state.asm index 34466de5..563ee1c2 100644 --- a/galactic-armada/src/main/states/gameplay/gameplay-state.asm +++ b/galactic-armada/src/main/states/gameplay/gameplay-state.asm @@ -6,6 +6,7 @@ SECTION "GameplayVariables", WRAM0 wScore:: ds 6 wLives:: db +wUpdateHud:: db SECTION "GameplayState", ROM0 @@ -26,15 +27,13 @@ InitGameplayState:: ld [wScore+3], a ld [wScore+4], a ld [wScore+5], a + ld [wUpdateHud], a call InitializeBackground call InitializePlayer call InitializeBullets call InitializeEnemies - ; Initiate STAT interrupts - call InitStatInterrupts - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -60,6 +59,9 @@ InitGameplayState:: ld a, 7 ld [rWX], a + ; Initiate STAT interrupts + call InitStatInterrupts + ; Turn the LCD on ld a, LCDCF_ON | LCDCF_BGON|LCDCF_OBJON | LCDCF_OBJ16 | LCDCF_WINON | LCDCF_WIN9C00|LCDCF_BG9800 ld [rLCDC], a @@ -120,6 +122,20 @@ UpdateGameplayState:: call WaitForOneVBlank ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ; Check if we need to redraw the hud + ; Doing it here to make sure it's in a VBlank window + ld a, [wUpdateHud] + and a + jp z, SkipHudRedraw + + call DrawLives + call DrawScore + + xor a + ld [wUpdateHud], a + +SkipHudRedraw: + jp UpdateGameplayState EndGameplay: diff --git a/galactic-armada/src/main/states/gameplay/hud.asm b/galactic-armada/src/main/states/gameplay/hud.asm index 2b82e083..d7083b82 100644 --- a/galactic-armada/src/main/states/gameplay/hud.asm +++ b/galactic-armada/src/main/states/gameplay/hud.asm @@ -6,6 +6,9 @@ SECTION "GameplayHUD", ROM0 ; ANCHOR: hud-increase-score IncreaseScore:: + ld a, 1 + ld [wUpdateHud], a; Tell gameplay-state to update hud + ; We have 6 digits, start with the right-most digit (the last byte) ld c, 0 ld hl, wScore+5 diff --git a/galactic-armada/src/main/states/gameplay/objects/bullets.asm b/galactic-armada/src/main/states/gameplay/objects/bullets.asm index 301c32e4..0ff2afd0 100644 --- a/galactic-armada/src/main/states/gameplay/objects/bullets.asm +++ b/galactic-armada/src/main/states/gameplay/objects/bullets.asm @@ -40,7 +40,7 @@ InitializeBullets:: xor a ld [wSpawnBullet], a - ; Copy the bullet tile data intto vram + ; Copy the bullet tile data into vram ld de, bulletTileData ld hl, BULLET_TILES_START ld bc, bulletTileDataEnd - bulletTileData @@ -52,10 +52,12 @@ InitializeBullets:: ld b, a ld hl, wBullets - ld [hl], a InitializeBullets_Loop: + ; Set as inactive + ld [hl], 0 + ; Increase the address ld a, l add PER_BULLET_BYTES_COUNT @@ -64,7 +66,7 @@ InitializeBullets_Loop: adc 0 ld h, a - ; Increase how many bullets we have initailized + ; Increase how many bullets we have initialized ld a, b inc a ld b, a @@ -78,7 +80,7 @@ InitializeBullets_Loop: ; ANCHOR: bullets-update-start UpdateBullets:: - ; Make sure we have SOME active enemies + ; Make sure we have SOME active bullets ld a, [wSpawnBullet] ld b, a ld a, [wActiveBulletCounter] @@ -113,7 +115,7 @@ UpdateBullets_Loop: cp MAX_BULLET_COUNT ret nc - ; Increase the bullet data our address is pointingtwo + ; Increase the bullet data our address is pointing to ld a, l add PER_BULLET_BYTES_COUNT ld l, a @@ -126,13 +128,13 @@ UpdateBullets_Loop: UpdateBullets_PerBullet: ; The first byte is if the bullet is active - ; If it's NOT zero, it's active, go to the normal update section + ; If it's NOT zero, it's active, go to the normal update section ld a, [hl] and a jp nz, UpdateBullets_PerBullet_Normal ; Do we need to spawn a bullet? - ; If we dont, loop to the next enemy + ; If we don't, loop to the next bullet ld a, [wSpawnBullet] and a jp z, UpdateBullets_Loop @@ -150,7 +152,7 @@ UpdateBullets_PerBullet_SpawnDeactivatedBullet: push hl - ; Set the current bullet as active + ; Set the current bullet as active ld a, 1 ld [hli], a @@ -161,7 +163,7 @@ UpdateBullets_PerBullet_SpawnDeactivatedBullet: ld d, a ; Descale the player's x position - ; the result will only be in the low byt + ; the result will only be in the low byte srl d rr b srl d @@ -220,7 +222,7 @@ UpdateBullets_PerBullet_Normal: ; See if our non scaled low byte is above 160 ld a, c - cp 178 + cp 160 ; If it's below 160, deactivate jp nc, UpdateBullets_DeActivateIfOutOfBounds @@ -233,8 +235,8 @@ UpdateBullets_PerBullet_Normal: ;; Drawing a metasprite ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - ; Save the address of the metasprite into the 'wMetaspriteAddress' variable - ; Our DrawMetasprites functoin uses that variable + ; Save the address of the metasprite into the 'wMetaspriteAddress' variable + ; Our DrawMetasprites function uses that variable ld a, LOW(bulletMetasprite) ld [wMetaspriteAddress], a ld a, HIGH(bulletMetasprite) @@ -248,7 +250,7 @@ UpdateBullets_PerBullet_Normal: ld a, c ld [wMetaspriteY], a - ; Actually call the 'DrawMetasprites function + ; Actually call the 'DrawMetasprites' function call DrawMetasprites ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -278,7 +280,7 @@ UpdateBullets_DeActivateIfOutOfBounds: ; ANCHOR: fire-bullets FireNextBullet:: - ; Make sure we don't have the max amount of enmies + ; Make sure we don't have the max amount of bullets ld a, [wActiveBulletCounter] cp MAX_BULLET_COUNT ret nc diff --git a/galactic-armada/src/main/states/gameplay/objects/collision/enemy-bullet-collision.asm b/galactic-armada/src/main/states/gameplay/objects/collision/enemy-bullet-collision.asm index 6c411b61..87fe993a 100644 --- a/galactic-armada/src/main/states/gameplay/objects/collision/enemy-bullet-collision.asm +++ b/galactic-armada/src/main/states/gameplay/objects/collision/enemy-bullet-collision.asm @@ -139,7 +139,7 @@ CheckCurrentEnemyAgainstBullets_PerBullet_Y_Overlap: srl c rr b - ; preserve our first byte addresss + ; preserve our first byte address pop hl push hl @@ -178,7 +178,7 @@ CheckCurrentEnemyAgainstBullets_PerBullet_Y_Overlap: ; ANCHOR: enemy-bullet-collision-per-bullet-collision CheckCurrentEnemyAgainstBullets_PerBullet_Collision: - ; set the active byte and x value to 0 for bullets + ; set the active byte and x value to 0 for bullets xor a ld [hli], a ld [hl], a @@ -188,13 +188,12 @@ CheckCurrentEnemyAgainstBullets_PerBullet_Collision: ld a, [wUpdateEnemiesCurrentEnemyAddress+1] ld h, a - ; set the active byte and x value to 0 for enemies + ; set the active byte and x value to 0 for enemies xor a ld [hli], a ld [hl], a call IncreaseScore - call DrawScore ; Decrease how many active enemies their are ld a, [wActiveEnemyCounter] diff --git a/galactic-armada/src/main/states/gameplay/objects/enemies.asm b/galactic-armada/src/main/states/gameplay/objects/enemies.asm index 091bd1ce..aadc74d3 100644 --- a/galactic-armada/src/main/states/gameplay/objects/enemies.asm +++ b/galactic-armada/src/main/states/gameplay/objects/enemies.asm @@ -102,7 +102,7 @@ UpdateEnemies:: ; ANCHOR: enemies-update-loop UpdateEnemies_Loop: - ; Check our coutner, if it's zero + ; Check our counter, if it's zero ; Stop the function ld a, [wUpdateEnemiesCounter] inc a @@ -112,7 +112,7 @@ UpdateEnemies_Loop: cp MAX_ENEMY_COUNT ret nc - ; Increase the enemy data our address is pointingtwo + ; Increase the enemy data our address is pointing to ld a, l add PER_ENEMY_BYTES_COUNT ld l, a @@ -170,7 +170,7 @@ UpdateEnemies_SpawnNewEnemy: ; ANCHOR: enemies-update-per-enemy2 UpdateEnemies_PerEnemy_Update: - ; Save our first bytye + ; Save our first byte push hl ; Get our move speed in e @@ -204,7 +204,7 @@ UpdateEnemies_PerEnemy_Update: pop hl - ; Descale the y psoition + ; Descale the y position srl d rr c srl d @@ -238,7 +238,6 @@ UpdateEnemies_PerEnemy_CheckPlayerCollision: push hl call DamagePlayer - call DrawLives pop hl @@ -276,11 +275,11 @@ UpdateEnemies_NoCollisionWithPlayer:: ; ANCHOR: draw-enemy-metasprites ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - ; call the 'DrawMetasprites function. setup variables and call + ; call the 'DrawMetasprites' function. setup variables and call ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Save the address of the metasprite into the 'wMetaspriteAddress' variable - ; Our DrawMetasprites functoin uses that variable + ; Our DrawMetasprites function uses that variable ld a, LOW(enemyShipMetasprite) ld [wMetaspriteAddress+0], a ld a, HIGH(enemyShipMetasprite) @@ -294,7 +293,7 @@ UpdateEnemies_NoCollisionWithPlayer:: ld a, [wCurrentEnemyY] ld [wMetaspriteY], a - ; Actually call the 'DrawMetasprites function + ; Actually call the 'DrawMetasprites' function call DrawMetasprites ; ANCHOR_END: draw-enemy-metasprites @@ -313,12 +312,12 @@ UpdateEnemies_NoCollisionWithPlayer:: ; ANCHOR: enemies-spawn TryToSpawnEnemies:: - ; Increase our spwncounter + ; Increase our spawn counter ld a, [wSpawnCounter] inc a ld [wSpawnCounter], a - ; Check our spawn acounter + ; Check our spawn a counter ; Stop if it's below a given value ld a, [wSpawnCounter] cp ENEMY_SPAWN_DELAY_MAX @@ -330,7 +329,7 @@ TryToSpawnEnemies:: cp 0 ret nz - ; Make sure we don't have the max amount of enmies + ; Make sure we don't have the max amount of enemies ld a, [wActiveEnemyCounter] cp MAX_ENEMY_COUNT ret nc diff --git a/galactic-armada/src/main/states/gameplay/objects/player.asm b/galactic-armada/src/main/states/gameplay/objects/player.asm index 17cd0cac..8675a0bd 100644 --- a/galactic-armada/src/main/states/gameplay/objects/player.asm +++ b/galactic-armada/src/main/states/gameplay/objects/player.asm @@ -170,12 +170,12 @@ UpdatePlayer_UpdateSprite: rr c ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - ; Drawing the palyer metasprite + ; Drawing the player metasprite ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Save the address of the metasprite into the 'wMetaspriteAddress' variable - ; Our DrawMetasprites functoin uses that variable + ; Our DrawMetasprites function uses that variable ld a, LOW(playerTestMetaSprite) ld [wMetaspriteAddress+0], a ld a, HIGH(playerTestMetaSprite) @@ -190,7 +190,7 @@ UpdatePlayer_UpdateSprite: ld a, c ld [wMetaspriteY], a - ; Actually call the 'DrawMetasprites function + ; Actually call the 'DrawMetasprites' function call DrawMetasprites; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -212,7 +212,8 @@ TryShoot: ; ANCHOR: player-damage DamagePlayer:: - + ld a, 1 + ld [wUpdateHud], a; Tell gameplay-state to update hud xor a ld [mPlayerFlash], a diff --git a/galactic-armada/src/main/states/story/story-state.asm b/galactic-armada/src/main/states/story/story-state.asm index 1811fae7..7c6b9ea4 100644 --- a/galactic-armada/src/main/states/story/story-state.asm +++ b/galactic-armada/src/main/states/story/story-state.asm @@ -15,7 +15,7 @@ InitStoryState:: ; ANCHOR: story-screen-data Story: - .Line1 db "the galatic empire", 255 + .Line1 db "the galactic empire", 255 .Line2 db "rules the galaxy", 255 .Line3 db "with an iron", 255 .Line4 db "fist.", 255 @@ -55,7 +55,7 @@ UpdateStoryState:: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Save the passed value into the variable: mWaitKey - ; The WaitForKeyFunction always checks against this vriable + ; The WaitForKeyFunction always checks against this variable ld a, PADF_A ld [mWaitKey], a @@ -92,7 +92,7 @@ UpdateStoryState:: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Save the passed value into the variable: mWaitKey - ; The WaitForKeyFunction always checks against this vriable + ; The WaitForKeyFunction always checks against this variable ld a, PADF_A ld [mWaitKey], a diff --git a/galactic-armada/src/main/states/title-screen/title-screen-state.asm b/galactic-armada/src/main/states/title-screen/title-screen-state.asm index ba48ea5c..ffc80f6f 100644 --- a/galactic-armada/src/main/states/title-screen/title-screen-state.asm +++ b/galactic-armada/src/main/states/title-screen/title-screen-state.asm @@ -62,7 +62,7 @@ UpdateTitleScreenState:: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Save the passed value into the variable: mWaitKey - ; The WaitForKeyFunction always checks against this vriable + ; The WaitForKeyFunction always checks against this variable ld a, PADF_A ld [mWaitKey], a diff --git a/po/it.po b/po/it.po index b94fb223..e6449d68 100644 --- a/po/it.po +++ b/po/it.po @@ -8865,7 +8865,7 @@ msgid "```rgbasm,linenos,start=260\n" msgstr "" #: src/part3/bullets.md:337 -msgid " ; Make sure we don't have the max amount of enmies\n" +msgid " ; Make sure we don't have the max amount of enemies\n" " ld a, [wActiveBulletCounter]\n" " cp a, MAX_BULLET_COUNT\n" " ret nc" @@ -9477,7 +9477,7 @@ msgid " ; Check our next enemy x position variable\n" msgstr "" #: src/part3/enemies.md:391 -msgid " ; Make sure we don't have the max amount of enmies\n" +msgid " ; Make sure we don't have the max amount of enemies\n" " ld a, [wActiveEnemyCounter]\n" " cp a, MAX_ENEMY_COUNT\n" " ret nc" diff --git a/src/part3/bullets.md b/src/part3/bullets.md index 7c656581..74ae79ee 100644 --- a/src/part3/bullets.md +++ b/src/part3/bullets.md @@ -42,11 +42,11 @@ For we each bullet, we'll do the following: * Check if active * Get our x position, save into b -* Get our y scaled positon, save into c (low byte), and d (high byte) +* Get our y scaled position, save into c (low byte), and d (high byte) * Decrease our y position to move the bullet upwards * Reset HL to the first byte of our bullet * Descale the y position we have in c & d, and jump to our deactivation code if c (the low byte) is high enough -* Draw our bullet metasprit, if it wasn't previously deactivated +* Draw our bullet metasprite, if it wasn't previously deactivated ```rgbasm,linenos,start={{#line_no_of "" ../../galactic-armada/src/main/states/gameplay/objects/bullets.asm:bullets-update-per}} {{#include ../../galactic-armada/src/main/states/gameplay/objects/bullets.asm:bullets-update-per}} diff --git a/src/part3/collision.md b/src/part3/collision.md index a51800e3..2a48be31 100644 --- a/src/part3/collision.md +++ b/src/part3/collision.md @@ -1,10 +1,10 @@ # Collision Detection -Collision Detection is cruical to games. It can be a very complicated topic. In Galactic Armada, things will be kept super simple. We're going to perform a basic implementation of "Axis-Aligned Bounding Box Collision Detection": +Collision Detection is crucial to games. It can be a very complicated topic. In Galactic Armada, things will be kept super simple. We're going to perform a basic implementation of "Axis-Aligned Bounding Box Collision Detection": > One of the simpler forms of collision detection is between two rectangles that are axis aligned — meaning no rotation. The algorithm works by ensuring there is no gap between any of the 4 sides of the rectangles. Any gap means a collision does not exist.[^mdn_source] -The easiest way to check for overlap, is to check the difference bewteen their centers. If the absolute value of their x & y differences (I'll refer to as "the absolute difference") are BOTH smaller than the sum of their half widths, we have a collision. This collision detection is run for bullets against enemies, and enemies against the player. Here's a visualization with bullets and enemies. +The easiest way to check for overlap, is to check the difference between their centers. If the absolute value of their x & y differences (I'll refer to as "the absolute difference") are BOTH smaller than the sum of their half widths, we have a collision. This collision detection is run for bullets against enemies, and enemies against the player. Here's a visualization with bullets and enemies. ![CollisionDetectionVisualized.png](../assets/part3/img/CollisionDetectionVisualized.png) diff --git a/src/part3/enemies.md b/src/part3/enemies.md index 95dbe2fb..debe0de4 100644 --- a/src/part3/enemies.md +++ b/src/part3/enemies.md @@ -1,6 +1,6 @@ # Enemies -Enemies in SHMUPS often come in a variety of types, and travel also in a variety of patterns. To keep things simple for this tutorial, we'll have one enemy that flys straight downward. Because of this decision, the logic for enemies is going to be similar to bullets in a way. They both travel vertically and disappear when off screeen. Some differences to point out are: +Enemies in SHMUPS often come in a variety of types, and travel also in a variety of patterns. To keep things simple for this tutorial, we'll have one enemy that fly straight downward. Because of this decision, the logic for enemies is going to be similar to bullets in a way. They both travel vertically and disappear when off screen. Some differences to point out are: - Enemies are not spawned by the player, so we need logic that spawns them at random times and locations. - Enemies must check for collision against the player @@ -61,7 +61,7 @@ When We are done updating a single enemy, we'll jump to the "UpdateEnemies_Loop" {{#include ../../galactic-armada/src/main/states/gameplay/objects/enemies.asm:enemies-update-loop}} ``` -For updating enemies, we'll first get the enemies speed. Afterwards we'll increase the enemies 16-bit y position. Once we've done that, we'll descale the y position so we can check for collisions and draw the ennemy. +For updating enemies, we'll first get the enemies speed. Afterwards we'll increase the enemies 16-bit y position. Once we've done that, we'll descale the y position so we can check for collisions and draw the enemy. ```rgbasm,linenos,start={{#line_no_of "" ../../galactic-armada/src/main/states/gameplay/objects/enemies.asm:enemies-update-per-enemy2}} {{#include ../../galactic-armada/src/main/states/gameplay/objects/enemies.asm:enemies-update-per-enemy2}} @@ -71,7 +71,7 @@ For updating enemies, we'll first get the enemies speed. Afterwards we'll increa One of the differences between enemies and bullets is that enemies must check for collision against the player and also against bullets. For both of these cases, we'll use a simple Axis-Aligned Bounding Box test. We'll cover the specific logic in a later section. -If we have a collison against the player we need to damage the player, and redraw how many lives they have. In addition, it's optional, but we'll deactivate the enemy too when they collide with the player. +If we have a collision against the player we need to damage the player, and redraw how many lives they have. In addition, it's optional, but we'll deactivate the enemy too when they collide with the player. > Our "hl" registers should point to the active byte of the current enemy. We push and pop our "hl" registers to make sure we get back to that same address for later logic. diff --git a/src/part3/enemy-bullet-collision.md b/src/part3/enemy-bullet-collision.md index 87e5693c..532dd5d4 100644 --- a/src/part3/enemy-bullet-collision.md +++ b/src/part3/enemy-bullet-collision.md @@ -1,12 +1,12 @@ # Enemy-Bullet Collision -When we are udating enemies, we'll call a function called "CheckCurrentEnemyAgainstBullets". This will check the current enemy against all active bullets. +When we are updating enemies, we'll call a function called "CheckCurrentEnemyAgainstBullets". This will check the current enemy against all active bullets. -This fuction needs to loop through the bullet object pool, and check if our current enemy overlaps any bullet on both the x and y axis. If so, we'll deactivate the enemy and bullet. +This function needs to loop through the bullet object pool, and check if our current enemy overlaps any bullet on both the x and y axis. If so, we'll deactivate the enemy and bullet. Our "CheckCurrentEnemyAgainstBullets" function starts off in a manner similar to how we updated enemies & bullets. -> This function expects "hl" points to the curent enemy. We'll save that in a variable for later usage. +> This function expects "hl" points to the current enemy. We'll save that in a variable for later usage. ```rgbasm,linenos,start={{#line_no_of "" ../../galactic-armada/src/main/states/gameplay/objects/collision/enemy-bullet-collision.asm:enemy-bullet-collision-start}} {{#include ../../galactic-armada/src/main/states/gameplay/objects/collision/enemy-bullet-collision.asm:enemy-bullet-collision-start}} diff --git a/src/part3/gameplay.md b/src/part3/gameplay.md index c7f29209..f78edae0 100644 --- a/src/part3/gameplay.md +++ b/src/part3/gameplay.md @@ -12,7 +12,7 @@ Our gameplay state defines the following data and variables: {{#include ../../galactic-armada/src/main/states/gameplay/gameplay-state.asm:gameplay-data-variables}} ``` -For simplicity reasons, our score uses 6 bytes. Each byte repesents one digit in the score. +For simplicity reasons, our score uses 6 bytes. Each byte represents one digit in the score. ## Initiating the Gameplay Game State: @@ -58,7 +58,7 @@ Next, we'll reset our Shadow OAM and reset current Shadow OAM sprite address. {{#include ../../galactic-armada/src/main/states/gameplay/gameplay-state.asm:update-gameplay-oam}} ``` -Because we are going to be dealing with a lot of sprites on the screen, we will not be directly manipulating the gameboy's OAM sprites. We'll define a set of "shadow" (copy") OAM sprites, that all objects will use instaed. At the end of the gameplay looop, we'll copy the shadow OAM sprite objects into the hardware. +Because we are going to be dealing with a lot of sprites on the screen, we will not be directly manipulating the gameboy's OAM sprites. We'll define a set of "shadow" (copy") OAM sprites, that all objects will use instead. At the end of the gameplay loop, we'll copy the shadow OAM sprite objects into the hardware. Each object will use a random shadow OAM sprite. We need a way to keep track of what shadow OAM sprite is being used currently. For this, we've created a 16-bit pointer called "wLastOAMAddress". Defined in "src/main/utils/sprites.asm", this points to the data for the next inactive shadow OAM sprite. @@ -75,7 +75,7 @@ Next we'll update our gameplay elements: {{#include ../../galactic-armada/src/main/states/gameplay/gameplay-state.asm:update-gameplay-elements}} ``` -After all of that, at this point in time, the majority of gameplay is done for this iteration. We'll clear any remaining spirtes. This is very necessary becaus the number of active sprites changes from frame to frame. If there are any visible OAM sprites left onscreen, they will look weird and/or mislead the player. +After all of that, at this point in time, the majority of gameplay is done for this iteration. We'll clear any remaining sprites. This is very necessary becaus the number of active sprites changes from frame to frame. If there are any visible OAM sprites left onscreen, they will look weird and/or mislead the player. ```rgbasm,linenos,start={{#line_no_of "" ../../galactic-armada/src/main/states/gameplay/gameplay-state.asm:update-gameplay-clear-sprites}} {{#include ../../galactic-armada/src/main/states/gameplay/gameplay-state.asm:update-gameplay-clear-sprites}} diff --git a/src/part3/project-structure.md b/src/part3/project-structure.md index 99b44035..37883c2d 100644 --- a/src/part3/project-structure.md +++ b/src/part3/project-structure.md @@ -6,7 +6,7 @@ The code can be found at [https://github.com/gbdev/gb-asm-tutorial/tree/master/g :::tip -Part III Galactic Aramada is using `hardware.inc v4.0` +Part III Galactic Armada is using `hardware.inc v4.0` ::: @@ -18,7 +18,7 @@ Here’s a basic look at how the project is structured: :::tip -Generated files should never be included in VCS repositories. It unneccessarily bloats the repo. The folders below marked with \* contains assets generated from running the Makefile and are not included in the repository. +Generated files should never be included in VCS repositories. It unnecessarily bloats the repo. The folders below marked with \* contains assets generated from running the Makefile and are not included in the repository. ::: @@ -68,8 +68,7 @@ The following backgrounds and sprites are used in Galactic Armada: - -These images were originally created in Aseprite. The original templates are also included in the repository. They were exported as a PNG **with a specific color palette**. Ater being exported as a PNG, when you run `make`, they are converted into `.2bpp` and `.tilemap` files via the RGBDS tool: RGBGFX. +These images were originally created in Aseprite. The original templates are also included in the repository. They were exported as a PNG **with a specific color palette**. After being exported as a PNG, when you run `make`, they are converted into `.2bpp` and `.tilemap` files via the RGBDS tool: RGBGFX. > The **`rgbgfx`** program converts PNG images into data suitable for display on the Game Boy and Game Boy Color, or vice-versa. > diff --git a/src/part3/the-player.md b/src/part3/the-player.md index acc58fc6..8528b003 100644 --- a/src/part3/the-player.md +++ b/src/part3/the-player.md @@ -70,7 +70,7 @@ After we've potentially moved the player and/or shot a new bullet. We need to dr - Otherwise, decrease the "wPlayerFlash" variable by 5. - We'll shift all the bits of the "wPlayerFlash" variable to the right 4 times - If the result is less than 5, we'll stop flashing and draw our player metasprite. - - Otherwise, if the first bit of the decscaled "wPlayerFLash" variable is 1, we'll skip drawing the player. + - Otherwise, if the first bit of the descaled "wPlayerFLash" variable is 1, we'll skip drawing the player. > ***NOTE:** The following resumes from where the "UpdatePlayer_HandleInput" label ended above.