#define ZeichnenAnfangen() BeginDrawing()
#define ZeichnenAufhören() EndDrawing()
-#define SPEED 30
+#define SPEED 40
#define GRAVITY 20
#define FRAMELENGTH 0.1
#define JUMPVELOCITY -130
#define CHARADISPLAYWIDTH 140
#define DLGPADDING 5
#define CHARANAMETEXTSIZE 30
+#define DLGTEXTWIDTH SCREENWIDTH - DLGPADDING * 2 - CHARADISPLAYWIDTH
int current_dialogue = 0;
#define STAGECOUNT 3
-#define DIALOGUECOUNT 6
+#define DIALOGUECOUNT 9
#define PLATFORMCOUNT 5
#include "game.h"
struct dialogue dialogues[DIALOGUECOUNT] = {
{"Hello!! [press 'H' to advance dialogue]", "Ai-chan", "dialogue-img/aichan-default.png", GREEN},
- {"My name is Ai-chan, and i;m the AI of the Hyperion battleship :3", "Ai-chan", "dialogue-img/aichan-default.png", GREEN},
+ {"My name is Ai-chan, and i;m the AI of the Hyperion :3", "Ai-chan", "dialogue-img/aichan-default.png", GREEN},
{"(for context thsi is a honkai impact 3 reference... i swear it makes sense", "context", "dialogue-img/aichan-default.png", BLACK},
+ {"So there's these girls Rozaliya and Liliya who think they can become the main characters of a game...", "Ai-chan", "dialogue-img/aichan-default.png", GREEN},
+ {"I'm clearly way more awesome than them so I am becoming the main character of a game >:{", "Ai-chan", "dialogue-img/aichan-default.png", GREEN},
+ {"Now we have to find them and prove this!!", "Ai-chan", "dialogue-img/aichan-default.png", GREEN},
{"Please press 'A' and 'D' to move LEFT and RIGHT; advance to the RIGHT side of the screen to finish this level!!", "Ai-chan", "dialogue-img/aichan-default.png", GREEN},
+
+
{"Press 'H' to JUMP", "Ai-chan", "dialogue-img/aichan-default.png", GREEN},
+
+
{"YOU WIN!!", "Ai-chan", "dialogue-img/aichan-default.png", GREEN}
};
struct platform platforms[PLATFORMCOUNT] = {
{{0,320,640,160},GREEN},
+
+
{{0,320,640,160},GREEN},
{{310, 300, 40, 20}, GREEN},
+
+
{{0, 320, 640, 160}, GREEN},
{{320, 0, 320, 480}, GREEN}
};
struct stage stages[STAGECOUNT] = {
- {"Level 0", platforms, 1, dialogues, 4},
- {"Level 1", platforms+1, 2, dialogues+4, 1},
+ {"Level 0", platforms, 1, dialogues, 7},
+ {"Level 1", platforms+1, 2, dialogues+7, 1},
{"End", platforms+3, 2, dialogues+5, 1}
};
SetWindowIcon(LoadImage(ICONPATH));
SetTargetFPS(FPS);
+ SetTraceLogLevel(LOG_WARNING);
+
struct character *player = spielersetup();
frozen= 1; //for dialogue
if (!frozen) {variables(GetFrameTime(), player);};
ZeichnenAnfangen();
bühnezeichnen();
- spielerzeichnen();
+ if (!frozen) {spielerzeichnen();};
ZeichnenAufhören();
}
#include "game.h"
struct character player = {{310,220,15,18},{0,0}};
int inputs[3] = {KEY_A,KEY_D,KEY_H}; //left, right, jump/advance dialogue
-static struct spritesheet front_sheet;
-static struct spritesheet *sheets[1];
+static struct spritesheet front_sheet, walk_sheet;
+static struct spritesheet *sheets[2];
-Texture2D front_single;
-Texture2D txtr;
+static Texture2D front_single;
+static Texture2D txtr;
static float delta_player;
front_single = LoadTextureFromImage(img);
UnloadImage(img);
img = LoadImage("aichan-front-sheet.png");
- front_sheet.img = img; front_sheet.width_each = 15; front_sheet.height_each = 18; front_sheet.columns=13;
+ front_sheet = (struct spritesheet){ImageCopy(img), 15, 18, 13};
+ //front_sheet.img = img; front_sheet.width_each = 15; front_sheet.height_each = 18; front_sheet.columns=13;
UnloadImage(img);
sheets[0] = &front_sheet;
txtr = LoadTextureFromImage(front_sheet.img);
+
+ img = LoadImage("aichan_walk_sheet.png");
+ walk_sheet = (struct spritesheet){ImageCopy(img), 15, 18, 4};
+ UnloadImage(img);
+ sheets[1] = &walk_sheet;
+
return &player;
}
+int drawframe(struct spritesheet *sheet, Rectangle *croprec, int mirror);
+
int spielerzeichnen(void)
{
static float time_since_switch = FRAMELENGTH;
static Rectangle croprec = {0,0,15,18};
time_since_switch += delta_player;
if (time_since_switch >= FRAMELENGTH) {
- UnloadTexture(txtr);
- Image imgy = LoadImage("aichan-front-sheet.png");
- ImageCrop(&imgy,croprec);
- //ImageCrop(&imgy, croprec);
- txtr = LoadTextureFromImage(imgy);
- UnloadImage(imgy);
+ if (IsKeyDown(inputs[1])) {
+ drawframe(sheets[1], &croprec, 0);
+ } else if (IsKeyDown(inputs[0])) {
+ drawframe(sheets[1], &croprec, 1);
+ } else {
+ drawframe(sheets[0], &croprec, 0);
+ };
+
time_since_switch = 0.0;
- if (croprec.x < front_sheet.width_each * (front_sheet.columns - 1)) {croprec.x += front_sheet.width_each;} else {croprec.x = 0;};
-
}
DrawTexture(txtr, player.rect.x, player.rect.y, WHITE);
}
{
UnloadTexture(front_single);
UnloadTexture(txtr);
- UnloadImage(front_sheet.img);
+ UnloadImage(sheets[0]->img);
return 1;
}
+
+int drawframe(struct spritesheet *s, Rectangle *c, int mirror)
+{
+ UnloadTexture(txtr);
+ Image imgy = ImageFromImage(s->img, *c);
+ if (mirror) {ImageFlipHorizontal(&imgy);};
+ //ImageCrop(&imgy,croprec);
+ //ImageCrop(&imgy, croprec);
+ txtr = LoadTextureFromImage(imgy);
+ UnloadImage(imgy);
+ if (c->x < s->width_each * (s->columns - 1)) {c->x += s->width_each;} else {c->x = 0;};
+}
+