#define CHARANAMETEXTSIZE 30
#define DLGTEXTWIDTH SCREENWIDTH - DLGPADDING * 2 - CHARADISPLAYWIDTH
+#define COINPADDING 5
+#define COINWIDTH 10
+
+int COIN_COUNT = COINCOUNT;
+
int current_dialogue = 0;
int drawdialogueline(char *line);
int drawobject(struct object *object);
+int drawcoingroup(struct coingroup *coingroup);
+int collectcoin(struct coingroup *group, int index);
int objects_interacted[OBJECTCOUNT] = {0};
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);
+ };
if (frozen == 1) { //currently in dialogue at beginning of stage
if (stages[level].dialogues == NULL) {
};
int is_killed(struct Rectangle *rect) {
- for (int i = 0; i < stages[level].danger_count; i++) {
- if (CheckCollisionRecs(*rect, stages[level].dangers[i].rect)) {
+ struct stage *s = &stages[level];
+ for (int i = 0; i < s->danger_count; i++) {
+ if (CheckCollisionRecs(*rect, s->dangers[i].rect)) {
return 1;
};
};
+
+ //haha im just going to add checkign coins into here loll
+ 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}))) {
+ collectcoin(cg, n);
+ };
+ };
+ };
return 0;
};
//DrawText(l, CHARADISPLAYWIDTH + DLGPADDING, DLGY + DLGPADDING * 2 ,20, BLACK); //add text wrapping later
};
+Texture2D coin_txtr;
+Sound coin_sound;
+
int cleanup_level(void)
{
UnloadTexture(txtr);
+ UnloadTexture(coin_txtr);
+ UnloadSound(coin_sound);
+ CloseAudioDevice();
return 1;
}
}
return 1;
};
+
+int drawcoingroup(struct coingroup *cg)
+{
+ static int coin_loaded = 0;
+ if (!coin_loaded) {
+ Image img = LoadImage("img/coin_10_10.png");
+ coin_txtr = LoadTextureFromImage(img);
+ UnloadImage(img);
+ coin_loaded = 1;
+ };
+ 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);
+ };
+ };
+};
+
+
+int collectcoin(struct coingroup *cg, int i)
+{
+ static int sound_loaded = 0;
+ if (!sound_loaded) {
+ InitAudioDevice();
+ coin_sound = LoadSound("coin.wav"); // the sound is taken from an UTAU i recorded (i wanted to make sure i had the rights to it, and, well, it's my voice :))
+ if (IsSoundValid(coin_sound)) {
+ sound_loaded = 1;
+ };
+ };
+ if (sound_loaded) {
+ PlaySound(coin_sound);
+ };
+ cg->collected[i] = 1;
+};
#define PLATFORMCOUNT 83
#define DANGERCOUNT 34
#define OBJECTCOUNT 5
+#define COINCOUNT 32
+#define COINGROUPCOUNT 1
#include "game.h"
#include <stddef.h>
-//icons are 40x40
+//icons are 130x130
struct dialogue dialogues[DIALOGUECOUNT] = {
{"Hello!! [press 'H' to advance dialogue]", "Ai-chan", "dialogue-img/aichan-smile.png", GREEN},
{"This is probably some scheme by those two!!", "Ai-chan", "dialogue-img/aichan-angry.png", ORANGE},
{"no actually it's just too annoying to add dialogue that's different based on other things", "CONTEXT", "dialogue-img/context.png", BLACK},
- {"Hello! How are you, Ai-chan?", "Seele", "dialogue-img/seele.png", DARKBLUE},
+ {"Hello! How are you, Ai-chan?", "Seele", "dialogue-img/aichan-default.png", DARKBLUE},
{"... LITERALLY TERRIBLE BECAUSE OF YOUR FAKE IDOL FRIENDS >:(", "Ai-chan", "dialogue-img/aichan-angry", GREEN},
{"It cannot be this serious.", "Context", "dialogue-img/context.png", BLACK},
{"This cannot be this serious, can you just get it over with soon??", "Seele", "dialogue-img/seele_b.png", RED},
};
+int collected_coins[COINCOUNT] = {0};
+
+struct coingroup coins[COINGROUPCOUNT] = {
+ {{80,305},32,collected_coins}
+};
+
struct object objects[OBJECTCOUNT] = {
{{440,418,15,22}, "Sin Mal", "img/sin_15_22.png" ,dialogues+13,4, 0},
{{60,38,15,22}, "Herrscher of Sentience", "img/senti_15_22.png", dialogues+21,7, 1},
};
struct stage stages[STAGECOUNT] = {
- {"Movement", platforms, 1, dialogues, 7, danger, 0,NULL,0},
- {"Jumping", platforms+1, 2, dialogues+7, 1, danger, 0,NULL,0},
- {"Danger", platforms+3, 1, dialogues+8, 1, danger, 4,NULL,0},
- {"(level)", platforms+4, 5, NULL,0,danger+4,1,NULL,0},
- {"Wall-jumping", platforms+9, 3,dialogues+9,1,danger,0,NULL,0},
- {"(level)", platforms+12, 7, NULL,0,danger+5,4,NULL,0},
- {"Interact", platforms+19,4, dialogues+10,3,danger+9,3,objects,1},
- {"(level)", platforms+23,11,NULL,0,danger+12,5,NULL,0},
- {"Ominous", platforms+34,14,dialogues+17,2,danger+17,4,NULL,0},
- {"Senti", platforms+48,13,dialogues+19,2,danger+21,9,objects+1,1},
- {"Seele", platforms+61,12,dialogues+28,1,danger+30,1,objects+2,3},
- {"(level)", platforms+73,7,NULL,0,danger+31,2,NULL,0},
- {"Last level", platforms+80,3,dialogues+39,2,danger+33,1,NULL,0}
+ {"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},
+ {"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},
+ {"(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},
+ {"Senti", platforms+48,13,dialogues+19,2,danger+21,9,objects+1,1,NULL,0},
+ {"Seele", platforms+61,12,dialogues+28,1,danger+30,1,objects+2,3,NULL,0},
+ {"(level)", platforms+73,7,NULL,0,danger+31,2,NULL,0,NULL,0},
+ {"Last level", platforms+80,3,dialogues+39,2,danger+33,1,NULL,0,NULL,0}
};