]> _ Git - aichan-platformer.git/commitdiff
more coins for levels + make them get uncollected when you die (next: even. more...
authorparking_turkeys <roya1060wien@gmail.com>
Sat, 25 Jul 2026 16:04:43 +0000 (12:04 -0400)
committerparking_turkeys <roya1060wien@gmail.com>
Sat, 25 Jul 2026 16:04:43 +0000 (12:04 -0400)
game.h
level.c
level_data.h
main_v2.c

diff --git a/game.h b/game.h
index d3498e5..de0af09 100644 (file)
--- a/game.h
+++ b/game.h
@@ -81,6 +81,7 @@ struct coingroup {
        Vector2 position;
        int coin_count;
        int *collected;
+       int padding; //default: 5px :D
 };
 
 struct stage {
diff --git a/level.c b/level.c
index 0d91901..91c177b 100644 (file)
--- a/level.c
+++ b/level.c
@@ -59,12 +59,14 @@ int bühnezeichnen(void)
                } else {
                drawdialogue(stages[level].dialogues+current_dialogue);
                if (IsKeyPressed(ADVANCEKEY)) {
-                       if (++current_dialogue == stages[level].dialogue_count) { //dialogue over
+                       if (++current_dialogue >= stages[level].dialogue_count) { //dialogue over
                                current_dialogue = 0; //is this not activating or smth...
                                frozen = 0;
-                       }
-               }
-               }
+                       } else {
+                               int max_dialogue = currstage->dialogue_count;
+                       };
+               };
+               };
        } else if (frozen > 1) { //currently interacting with an object
                struct object *o = currstage->objects + (frozen - 2);
                drawdialogue(o->dialogues + current_dialogue);
@@ -139,10 +141,17 @@ int sliding_wall(struct Rectangle *rect)
        return 0;
 };
 
-int is_killed(struct Rectangle *rect) {
+int is_killed(struct Rectangle *rect) 
+{
        struct stage *s = &stages[level];
        for (int i = 0; i < s->danger_count; i++) {
-               if (CheckCollisionRecs(*rect, s->dangers[i].rect)) {
+               if (CheckCollisionRecs(*rect, s->dangers[i].rect)) { //if they're killed ill ... just remove the coins here lmao :p not a good idea but like. it'll be fine
+                       for (int n = 0; n < s->coingroup_count; n++) {
+                               struct coingroup *cg = s->coingroups+n;
+                               for (int x = 0; x < cg->coin_count; x++) {
+                                       cg->collected[x]=0;
+                               };
+                       }; 
                        return 1;
                };
        };
@@ -151,7 +160,7 @@ int is_killed(struct Rectangle *rect) {
        for (int i = 0; i < (s->coingroup_count); i++) {
                struct coingroup *cg = s->coingroups+i;
                for (int n = 0; n < (cg->coin_count); n++) {
-                       if ((cg->collected[n] == 0) && (CheckCollisionRecs(*rect,(Rectangle){(cg->position.x + 2 + n * (COINPADDING + COINWIDTH)), cg->position.y, COINWIDTH - 2, COINWIDTH}))) { 
+                       if ((cg->collected[n] == 0) && (CheckCollisionRecs(*rect,(Rectangle){(cg->position.x + 2 + n * (cg->padding + COINWIDTH)), cg->position.y, COINWIDTH - 4, COINWIDTH}))) { 
                                collectcoin(cg, n);
                        };
                };
@@ -263,7 +272,7 @@ int drawcoingroup(struct coingroup *cg)
        for (int i = 0; i < cg->coin_count; i++) {
                if (cg->collected[i] == 0) {
                        //draw the coin :3
-                       DrawTexture(coin_txtr, cg->position.x + i * (COINWIDTH + COINPADDING), cg->position.y, WHITE);
+                       DrawTexture(coin_txtr, cg->position.x + i * (COINWIDTH + cg->padding), cg->position.y, WHITE);
                };
        };
 };
index acbb5ad..f5e7c47 100644 (file)
@@ -3,8 +3,8 @@
 #define PLATFORMCOUNT 83
 #define DANGERCOUNT 34
 #define OBJECTCOUNT 5
-#define COINCOUNT 32
-#define COINGROUPCOUNT 1
+#define COINCOUNT 106
+#define COINGROUPCOUNT 11
 
 #include "game.h"
 #include <stddef.h>
@@ -196,10 +196,10 @@ struct platform platforms[PLATFORMCOUNT] = {
 };
 
 struct platform danger[DANGERCOUNT] = {
-       {{80,310,7,10}, RED},
-       {{160,310,7,10}, RED},
-       {{240,310,7,10}, RED},
-       {{320,310,7,10}, RED},
+       {{80,310,10,10}, RED},
+       {{160,310,10,10}, RED},
+       {{240,310,10,10}, RED},
+       {{320,310,10,10}, RED},
 
        
        {{80,440,480,40}, RED},
@@ -254,7 +254,23 @@ struct platform danger[DANGERCOUNT] = {
 int collected_coins[COINCOUNT] = {0};
 
 struct coingroup coins[COINGROUPCOUNT] = {
-       {{80,305},32,collected_coins}
+       {{80,305},32,collected_coins, 5},
+
+
+       {{75,305},11,collected_coins+32, 5},
+       {{245,285},10,collected_coins+43,5},
+       {{405,305},11,collected_coins+53,5},
+
+
+       {{40,305},6,collected_coins+64,70},
+       {{80,295},5,collected_coins+70,70},
+
+
+       {{65,305},1,collected_coins+75,5},
+       {{100,285},5,collected_coins+76,6},
+       {{200,255},4,collected_coins+81,5},
+       {{280,225},15,collected_coins+85,5},
+       {{560,405},5,collected_coins+100,6}
 };
 
 struct object objects[OBJECTCOUNT] = {
@@ -267,9 +283,9 @@ struct object objects[OBJECTCOUNT] = {
 
 struct stage stages[STAGECOUNT] = {
        {"Movement", platforms, 1, dialogues, 7, danger, 0,NULL,0,coins,1},
-       {"Jumping", platforms+1, 2, dialogues+7, 1, danger, 0,NULL,0,NULL,0},
-       {"Danger", platforms+3, 1, dialogues+8, 1, danger, 4,NULL,0,NULL,0},
-       {"(level)", platforms+4, 5, NULL,0,danger+4,1,NULL,0,NULL,0},
+       {"Jumping", platforms+1, 2, dialogues+7, 1, danger, 0,NULL,0,coins+1,3},
+       {"Danger", platforms+3, 1, dialogues+8, 1, danger, 4,NULL,0,coins+4,2},
+       {"(level)", platforms+4, 5, NULL,0,danger+4,1,NULL,0,coins+6,5},
        {"Wall-jumping", platforms+9, 3,dialogues+9,1,danger,0,NULL,0,NULL,0},
        {"(level)", platforms+12, 7, NULL,0,danger+5,4,NULL,0,NULL,0},
        {"Interact", platforms+19,4, dialogues+10,3,danger+9,3,objects,1,NULL,0},
index 7210a82..89fbcd5 100644 (file)
--- a/main_v2.c
+++ b/main_v2.c
@@ -10,7 +10,7 @@
 #include <math.h>
 #include <stdio.h> // seems useful
 
-int level = 0;
+int level = 3;
 int frozen = 0; //0:game, 1:stage dialogue, 2+:object[frozen-2] dialogue
 int mode = 0; //0:'start game', 1: 'levels', 2:'end screen' (later: 2 will be bossfight and 3 will be end screen lol)
 int fullsectime = 0;