Skip to content

Commit 1a8511f

Browse files
Removing 'main.asm' file, and fixing 'xor' compilation errors for #90 (#91)
* initial commit for #90 * removing main.asm fixing copy/paste typo committed adding spaces for some code snippets removing unused game-states.md file adding anchor to enemies section header * fixed naked xor for #90
1 parent db9eb64 commit 1a8511f

File tree

12 files changed

+57
-843
lines changed

12 files changed

+57
-843
lines changed

galactic-armada/main.asm

Lines changed: 0 additions & 788 deletions
This file was deleted.

galactic-armada/src/main/states/gameplay/objects/bullets.asm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,23 @@ wActiveBulletCounter:: db
1313
; how many bullet's we've updated
1414
wUpdateBulletsCounter: db
1515

16+
; ANCHOR: w-bullets
17+
1618
; Bytes: active, x , y (low), y (high)
1719
wBullets:: ds MAX_BULLET_COUNT*PER_BULLET_BYTES_COUNT
1820

21+
; ANCHOR_END: w-bullets
22+
1923
SECTION "Bullets", ROM0
2024

2125
bulletMetasprite::
2226
.metasprite1 db 0,0,8,0
2327
.metaspriteEnd db 128
2428

29+
; ANCHOR: bullets-tile-data
2530
bulletTileData:: INCBIN "src/generated/sprites/bullet.2bpp"
2631
bulletTileDataEnd::
32+
; ANCHOR_END: bullets-tile-data
2733

2834

2935
; ANCHOR_END: bullets-top

galactic-armada/src/main/states/gameplay/objects/enemies.asm

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,28 @@ wActiveEnemyCounter::db
1313
wUpdateEnemiesCounter:db
1414
wUpdateEnemiesCurrentEnemyAddress::dw
1515

16+
; ANCHOR: w-enemies
1617
; Bytes: active, x , y (low), y (high), speed, health
1718
wEnemies:: ds MAX_ENEMY_COUNT*PER_ENEMY_BYTES_COUNT
1819

20+
; ANCHOR_END: w-enemies
21+
1922
; ANCHOR_END: enemies-start
20-
; ANCHOR: enemies-tile-metasprite
23+
; ANCHOR: enemies-section-header
2124
SECTION "Enemies", ROM0
25+
; ANCHOR_END: enemies-section-header
2226

27+
; ANCHOR: enemies-tile-data
2328
enemyShipTileData:: INCBIN "src/generated/sprites/enemy-ship.2bpp"
2429
enemyShipTileDataEnd::
30+
; ANCHOR_END: enemies-tile-data
2531

32+
; ANCHOR: enemy-metasprites
2633
enemyShipMetasprite::
2734
.metasprite1 db 0,0,4,0
2835
.metasprite2 db 0,8,6,0
2936
.metaspriteEnd db 128
30-
; ANCHOR_END: enemies-tile-metasprite
37+
; ANCHOR_END: enemy-metasprites
3138

3239
; ANCHOR: enemies-initialize
3340
InitializeEnemies::
@@ -243,7 +250,7 @@ UpdateEnemies_PerEnemy_CheckPlayerCollision:
243250
UpdateEnemies_DeActivateEnemy:
244251

245252
; Set as inactive
246-
xor
253+
xor a
247254
ld [hl], a
248255

249256
; Decrease counter
@@ -265,6 +272,9 @@ UpdateEnemies_NoCollisionWithPlayer::
265272

266273
push hl
267274

275+
276+
; ANCHOR: draw-enemy-metasprites
277+
268278
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
269279
; call the 'DrawMetasprites function. setup variables and call
270280
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -287,6 +297,8 @@ UpdateEnemies_NoCollisionWithPlayer::
287297
; Actually call the 'DrawMetasprites function
288298
call DrawMetasprites
289299

300+
; ANCHOR_END: draw-enemy-metasprites
301+
290302
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
291303
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
292304
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

galactic-armada/src/main/states/gameplay/objects/player.asm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ mPlayerFlash: dw
1414
; ANCHOR: player-data
1515
SECTION "Player", ROM0
1616

17+
; ANCHOR: player-tile-data
1718
playerShipTileData: INCBIN "src/generated/sprites/player-ship.2bpp"
1819
playerShipTileDataEnd:
20+
; ANCHOR_END: player-tile-data
1921

2022
playerTestMetaSprite::
2123
.metasprite1 db 0,0,0,0

galactic-armada/src/main/utils/constants.inc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ DEF enemy_speedByte RB 1
2525
DEF enemy_healthByte RB 1
2626
DEF PER_ENEMY_BYTES_COUNT RB 0
2727

28+
; ANCHOR: bullet-offset-constants
2829
; from https://rgbds.gbdev.io/docs/v0.6.1/rgbasm.5#EXPRESSIONS
2930
; The RS group of commands is a handy way of defining structure offsets:
3031
RSRESET
@@ -33,6 +34,7 @@ DEF bullet_xByte RB 1
3334
DEF bullet_yLowByte RB 1
3435
DEF bullet_yHighByte RB 1
3536
DEF PER_BULLET_BYTES_COUNT RB 0
37+
; ANCHOR_END: bullet-offset-constants
3638

3739
; ANCHOR: sprite-vram-constants
3840
RSRESET

galactic-armada/src/main/utils/text-utils.asm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ SECTION "Text", ROM0
33

44
textFontTileData: INCBIN "src/generated/backgrounds/text-font.2bpp"
55
textFontTileDataEnd:
6+
; ANCHOR: load-text-font
67

78
LoadTextFontIntoVRAM::
89
; Copy the tile data
910
ld de, textFontTileData ; de contains the address where data will be copied from;
1011
ld hl, $9000 ; hl contains the address where data will be copied to;
1112
ld bc, textFontTileDataEnd - textFontTileData ; bc contains how many bytes we have to copy.
1213
jp CopyDEintoMemoryAtHL
14+
15+
; ANCHOR_END: load-text-font
16+
1317

1418
; ANCHOR: draw-text-tiles
1519
DrawTextTilesLoop::

src/part3/collision.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ For this, we've created a basic function called "CheckObjectPositionDifference".
1212

1313
Here's an example of how to call this function:
1414

15-
> We have the player's x & y position in registers d & e respectively. We have the enemy's x & y position in registers b & c respectively. If there is no overlap on the x or y axis, the program jumps to the "NoCollisionWithPlayer" label.
15+
> We have the player's Y position in the `d` register. We'll check it's value against the y value of the current enemy, which we have in a variable named `wCurrentEnemyY`.
1616
17-
```rgbasm,linenos,start={{#line_no_of "" ../../galactic-armada/main.asm:player-collision-label}}
18-
{{#include ../../galactic-armada/main.asm:player-collision-label}}
17+
```rgbasm,linenos,start={{#line_no_of "" ../../galactic-armada/src/main/states/gameplay/objects/collision/enemy-player-collision.asm:check-y-overlap}}
18+
{{#include ../../galactic-armada/src/main/states/gameplay/objects/collision/enemy-player-collision.asm:check-y-overlap}}
1919
```
2020

2121
When checking for collision, we'll use that function twice. Once for the x-axis, and again for the y-axis.

src/part3/enemies.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@ Here are the RAM variables we'll use for our enemies:
2121

2222
Just like with bullets, we'll setup ROM data for our enemies tile data and metasprites.
2323

24-
```rgbasm,linenos,start={{#line_no_of "" ../../galactic-armada/src/main/states/gameplay/objects/enemies.asm:enemies-tile-metasprite}}
25-
{{#include ../../galactic-armada/src/main/states/gameplay/objects/enemies.asm:enemies-tile-metasprite}}
24+
```rgbasm,linenos,start={{#line_no_of "" ../../galactic-armada/src/main/states/gameplay/objects/enemies.asm:enemies-section-header}}
25+
{{#include ../../galactic-armada/src/main/states/gameplay/objects/enemies.asm:enemies-section-header}}
26+
27+
{{#include ../../galactic-armada/src/main/states/gameplay/objects/enemies.asm:enemies-tile-data}}
28+
29+
{{#include ../../galactic-armada/src/main/states/gameplay/objects/enemies.asm:enemy-metasprites}}
2630
```
2731

2832
## Initializing Enemies

src/part3/game-states.md

Lines changed: 0 additions & 35 deletions
This file was deleted.

src/part3/object-pools.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Galactic Armada will use "object pools" for bullets and enemies. A fixed amount
44

55
Constants are also created for the size of each object, and what each byte is. These constants are in the “src/main/utils/constants.inc” file and utilize RGBDS offset constants (a really cool feature)
66

7-
```rgbasm,linenos,start={{#line_no_of "" ../../galactic-armada/main.asm:bullet-offset-constants}}
8-
{{#include ../../galactic-armada/main.asm:bullet-offset-constants}}
7+
```rgbasm,linenos,start={{#line_no_of "" ../../galactic-armada/src/main/utils/constants.inc:bullet-offset-constants}}
8+
{{#include ../../galactic-armada/src/main/utils/constants.inc:bullet-offset-constants}}
99
```
1010

1111
The two object types that we need to loop through are Enemies and Bullets.
@@ -19,8 +19,8 @@ The two object types that we need to loop through are Enemies and Bullets.
1919
5. Speed - How fast they move
2020
6. Health - How many bullets they can take
2121

22-
```rgbasm,linenos,start={{#line_no_of "" ../../galactic-armada/main.asm:w-enemies}}
23-
{{#include ../../galactic-armada/main.asm:w-enemies}}
22+
```rgbasm,linenos,start={{#line_no_of "" ../../galactic-armada/src/main/states/gameplay/objects/enemies.asm:w-enemies}}
23+
{{#include ../../galactic-armada/src/main/states/gameplay/objects/enemies.asm:w-enemies}}
2424
```
2525

2626
![EnemyBytesVisualized.png](../assets/part3/img/EnemyBytesVisualized.png)
@@ -32,8 +32,8 @@ The two object types that we need to loop through are Enemies and Bullets.
3232
3. Y (low) - The lower byte of their 16-bit (scaled) y position
3333
4. Y (high) - The higher byte of their 16-bit (scaled) y position
3434

35-
```rgbasm,linenos,start={{#line_no_of "" ../../galactic-armada/main.asm:w-bullets}}
36-
{{#include ../../galactic-armada/main.asm:w-bullets}}
35+
```rgbasm,linenos,start={{#line_no_of "" ../../galactic-armada/src/main/states/gameplay/objects/bullets.asm:w-bullets}}
36+
{{#include ../../galactic-armada/src/main/states/gameplay/objects/bullets.asm:w-bullets}}
3737
```
3838

3939
![BulletBytesVisualized.png](../assets/part3/img/BulletBytesVisualized.png)

0 commit comments

Comments
 (0)