//draw all the platforms and stuff
for (int i = 0; i < stages[level].platform_count; i++) {
DrawRectangleRec(stages[level].platforms[i].rect, stages[level].platforms[i].colour);
+ if (drawhitboxes) { DrawRectangleLinesEx(currstage->platforms[i].rect, 1, BLACK); };
};
for (int i = 0; i < stages[level].danger_count; i++) {
DrawRectangleRec(stages[level].dangers[i].rect, stages[level].dangers[i].colour);
+ if (drawhitboxes) { DrawRectangleLinesEx(currstage->dangers[i].rect, 1, WHITE); };
}
for (int i = 0; i < currstage->object_count; i++) {
drawobject(currstage->objects+i);
}
for (int i = 0; i < currstage->coingroup_count; i++) {
- drawcoingroup(currstage->coingroups+i);
+ drawcoingroup(currstage->coingroups+i);
+
};
if (frozen == 1) { //currently in dialogue at beginning of stage
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 * (cg->padding + COINWIDTH)), cg->position.y, COINWIDTH - 4, COINWIDTH}))) {
+ Rectangle cr = {(cg->position.x + 2 + n * (cg->padding + COINWIDTH)), (cg->position.y + 2), (COINWIDTH - 4), (COINWIDTH - 4)};
+ if ((cg->collected[n] == 0) && (CheckCollisionRecs(*rect,cr))) {
collectcoin(cg, n);
};
};
t = LoadTextureFromImage(img);
UnloadImage(img);
DrawTexture(t,o->rect.x,o->rect.y,WHITE);
+ if (drawhitboxes) {
+ DrawRectangleLinesEx(o->rect,1,PINK);
+ };
//DrawText("R", <-- I was going to try to add an "R" tip but it seemed hard... ill do it sometime lol
return 1;
};
if (cg->collected[i] == 0) {
//draw the coin :3
DrawTexture(coin_txtr, cg->position.x + i * (COINWIDTH + cg->padding), cg->position.y, WHITE);
+ if (drawhitboxes) {
+ Rectangle cr = {(cg->position.x + 2 + i * (cg->padding + COINWIDTH)), (cg->position.y + 2), (COINWIDTH - 4), (COINWIDTH - 4)};
+ DrawRectangleLinesEx(cr, 1, PINK);
+ };
};
};
};
#define PLATFORMCOUNT 83
#define DANGERCOUNT 34
#define OBJECTCOUNT 5
-#define COINCOUNT 106
-#define COINGROUPCOUNT 11
+#define COINCOUNT 153
+#define COINGROUPCOUNT 16
#include "game.h"
#include <stddef.h>
{{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}
+ {{560,405},5,collected_coins+100,6},
+
+
+ {{80,305},31,collected_coins+105,5},
+ {{400,65},5,collected_coins+136,6},
+ {{540,85},5,collected_coins+141,6},
+
+
+ {{80,385},6,collected_coins+146,6},
+ {{175,400},1,collected_coins+152,5}
+
};
struct object objects[OBJECTCOUNT] = {
{"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},
+ {"Wall-jumping", platforms+9, 3,dialogues+9,1,danger,0,NULL,0,coins+11,3},
+ {"(level)", platforms+12, 7, NULL,0,danger+5,4,NULL,0,coins+14,2},
{"Interact", platforms+19,4, dialogues+10,3,danger+9,3,objects,1,NULL,0},
{"(level)", platforms+23,11,NULL,0,danger+12,5,NULL,0,NULL,0},
{"Ominous", platforms+34,14,dialogues+17,2,danger+17,4,NULL,0,NULL,0},
#include <math.h>
#include <stdio.h> // seems useful
-int level = 3;
+int level = 5;
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;
int deaths = 0;
+int drawhitboxes = 0;
int main(void)
{
break;
case LEVELMODE:
if (!frozen) {variables(GetFrameTime(), player);};
+ if (IsKeyPressed(KEY_Q)) { drawhitboxes = 1; };
if (mode == LEVELMODE) {
ZeichnenAnfangen();
bühnezeichnen();
if (!frozen) {spielerzeichnen();};
DrawRectangle(1, 468, 45, 12, WHITE);
DrawText(TextFormat("FPS: %2i", GetFPS()), 2, 469, 10, BLACK);
- DrawRectangle(1, 0, 45, 12, WHITE);
+ DrawRectangle(1, 0,115, 12, WHITE);
DrawText(TextFormat("Seconds played: %5.2f", GetTime()), 2, 0, 10, BLACK);
ZeichnenAufhören();
};