Sfoglia il codice sorgente

Updated cactus icon and sprite transparency

Rrycbarm 2 anni fa
parent
commit
58198e39e2
6 ha cambiato i file con 5 aggiunte e 6 eliminazioni
  1. 0 2
      README.md
  2. BIN
      assets/Cactus.png
  3. BIN
      dist/debug/t-rex-runner_d.elf
  4. BIN
      dist/t-rex-runner.fap
  5. 5 4
      trexrunner.c
  6. BIN
      video.gif

+ 0 - 2
README.md

@@ -10,11 +10,9 @@ Flipper Zero port of Chrome's running T-rex game
 - Added score system
 
 ## TODO
-- Change cactus icon
 - More random cactus spawn
 - Increase cactus speed with time
 - Fix background speed with cactus
-- Fix Dino transparency
 - Allow to play again without the need to close the game in the lose screen
 
 ## Gameplay

BIN
assets/Cactus.png


BIN
dist/debug/t-rex-runner_d.elf


BIN
dist/t-rex-runner.fap


+ 5 - 4
trexrunner.c

@@ -10,7 +10,7 @@
 #include "t-rex-runner_icons.h"
 
 #define DINO_START_X 10
-#define DINO_START_Y 35 // 64 - 22 - BACKGROUND_H / 2 - 1
+#define DINO_START_Y 34 // 64 - 22 - BACKGROUND_H / 2 - 2
 
 #define FPS 20
 
@@ -19,7 +19,7 @@
 #define GRAVITY 60
 #define JUMP_SPEED 30
 
-#define CACTUS_W 8
+#define CACTUS_W 10
 #define CACTUS_H 10
 #define START_x_speed 25
 
@@ -100,7 +100,7 @@ static void timer_callback(void *ctx) {
     // Update Cactus state
     if (game_state->has_cactus){
         game_state->cactus_position = game_state->cactus_position - game_state->x_speed * delta_time_ms / 1000;
-        if (game_state->cactus_position <= CACTUS_W + 1) {
+        if (game_state->cactus_position <= 0 ) {
             game_state->has_cactus = 0;
             game_state->score = game_state->score + 1;
         }
@@ -149,7 +149,8 @@ static void render_callback(Canvas *const canvas, void *ctx) {
 
         // Show cactus
         if (game_state->has_cactus)
-            canvas_draw_triangle(canvas, game_state->cactus_position, 64 - BACKGROUND_H + CACTUS_W, CACTUS_W, CACTUS_H, CanvasDirectionBottomToTop);
+            //canvas_draw_triangle(canvas, game_state->cactus_position, 64 - BACKGROUND_H + CACTUS_W, CACTUS_W, CACTUS_H, CanvasDirectionBottomToTop);
+            canvas_draw_icon(canvas, game_state->cactus_position, 64 - BACKGROUND_H/2 - CACTUS_H - 2, &I_Cactus);
 
         // Show score
         if(game_state->score == 0)

BIN
video.gif