Browse Source

decrement white score when shooting

Thomas B 1 month ago
parent
commit
cb8d910353
3 changed files with 14 additions and 3 deletions
  1. 8
    1
      README.md
  2. 1
    1
      docs/index.html
  3. 5
    1
      src/game.c

+ 8
- 1
README.md View File

12
 
12
 
13
 ## Getting Started
13
 ## Getting Started
14
 
14
 
15
-You need the [GBDK-2020](https://gbdk.org/docs/api/docs_getting_started.html) to build the ROM and [Gearboy](https://github.com/drhelius/Gearboy) to emulate it comfortably.
15
+You need the [GBDK-2020](https://gbdk.org/docs/api/docs_getting_started.html) to build the ROM and [Gearboy](https://github.com/drhelius/Gearboy), [SameBoy](https://sameboy.github.io/), [Emulicious](https://emulicious.net/) or [BGB](https://bgb.bircd.org/) to emulate it comfortably.
16
 Then just build a debug version and run it in the emulator, with debug symbols already loaded.
16
 Then just build a debug version and run it in the emulator, with debug symbols already loaded.
17
 
17
 
18
     make run
18
     make run
19
+    make sgb_run
20
+    make bgb_run
21
+
22
+Use SameBoy to test out the SGB border feature.
23
+Also see below for symbolic debugging with Emulicious.
19
 
24
 
20
 For the release build, simply add `GBDK_RELEASE=1` to your make invocation after running `make clean`.
25
 For the release build, simply add `GBDK_RELEASE=1` to your make invocation after running `make clean`.
21
 
26
 
22
     make clean
27
     make clean
23
     make GBDK_RELEASE=1 run
28
     make GBDK_RELEASE=1 run
24
 
29
 
30
+You can also directly write to a flashcart using `flashgbx` with `make flash`.
31
+
25
 ## IDE Integration
32
 ## IDE Integration
26
 
33
 
27
 I'm using [https://kate-editor.org/] which supports VSCode-style LSP and debugging with integrated plugins.
34
 I'm using [https://kate-editor.org/] which supports VSCode-style LSP and debugging with integrated plugins.

+ 1
- 1
docs/index.html View File

67
                 <tr><td>Select (V)</td><td>About</td></tr>
67
                 <tr><td>Select (V)</td><td>About</td></tr>
68
             </table>
68
             </table>
69
             <p>Press Left or Right on the title screen to show either the black or white highscores. Press Select to show the about screen and build info. In-game press Start to pause and resume. While paused press Select to return to the menu.</p>
69
             <p>Press Left or Right on the title screen to show either the black or white highscores. Press Select to show the about screen and build info. In-game press Start to pause and resume. While paused press Select to return to the menu.</p>
70
-            <p>Collect small white spheres to get +5 white score. Collect small black spheres to get +5 black score. The opposite color will reduce your score when collected. Large black holes will attract you and damage your ship when touched. Large white spheres will repel you and replenish your health when touched. Accelerating will reduce your fuel, which will recharge when not accelerating. You can shoot large spheres for +10 points.<p>
70
+            <p>Collect small white spheres to get +5 white score. Collect small black spheres to get +5 black score. The opposite color will reduce your score when collected. Shooting while you have a white score will reduce it by one. Large black holes will attract you and damage your ship when touched. Large white spheres will repel you and replenish your health when touched. Accelerating will reduce your fuel, which will recharge when not accelerating. You can shoot large spheres for +10 points.<p>
71
             <p>For a more detailed description of the original game check out the <a href="https://gta.fandom.com/wiki/Duality">Duality article on GTA Wiki</a>.</p>
71
             <p>For a more detailed description of the original game check out the <a href="https://gta.fandom.com/wiki/Duality">Duality article on GTA Wiki</a>.</p>
72
         </div>
72
         </div>
73
         <div class="text">
73
         <div class="text">

+ 5
- 1
src/game.c View File

172
         key_read();
172
         key_read();
173
 
173
 
174
         enum ACCELERATION acc = 0;
174
         enum ACCELERATION acc = 0;
175
+        int32_t prev_score = score;
175
 
176
 
176
         if (key_pressed(J_LEFT)) {
177
         if (key_pressed(J_LEFT)) {
177
             rot = (rot - 1) & (ROT_INVALID - 1);
178
             rot = (rot - 1) & (ROT_INVALID - 1);
315
 
316
 
316
             if (ret == OBJ_ADDED) {
317
             if (ret == OBJ_ADDED) {
317
                 snd_shot();
318
                 snd_shot();
319
+
320
+                if (score > 0) {
321
+                    score--;
322
+                }
318
             }
323
             }
319
         }
324
         }
320
 
325
 
348
             hiwater = ship_hiwater;
353
             hiwater = ship_hiwater;
349
         }
354
         }
350
 
355
 
351
-        int32_t prev_score = score;
352
         int16_t damage = obj_do(&spd_x, &spd_y, &score, &hiwater, 0);
356
         int16_t damage = obj_do(&spd_x, &spd_y, &score, &hiwater, 0);
353
         if (damage > 0) {
357
         if (damage > 0) {
354
             if (debug_flags & DBG_GOD_MODE) {
358
             if (debug_flags & DBG_GOD_MODE) {

Loading…
Cancel
Save