From: parking_turkeys Date: Sun, 26 Jul 2026 19:09:37 +0000 (-0400) Subject: So im just committing rn before i start work today! X-Git-Tag: v1.0~8 X-Git-Url: http://git.parking-turkeys.net/?a=commitdiff_plain;h=7178c16205edd769189c1ecd4da676af1390945c;p=aichan-platformer.git So im just committing rn before i start work today! for now the way it works is that all attacks are in 'skills[]' and ig the enemy attacks will have their own array owo --- diff --git a/bossfight.c b/bossfight.c index affaa75..7d236d7 100644 --- a/bossfight.c +++ b/bossfight.c @@ -3,8 +3,39 @@ #include #define DLGCOUNT 15 + +#define PROMEMAXHP 262144 +#define PLAYERMAXHP 524288 +#define PROMEIMGPATH "dialogue-img/aichan-default.png" //REPLACE LATER!! +#define BRICKCOOLDOWNFULL 5 +#define SKILLCOUNT 1 +#define DEFAULTANIMFRAME "dialogue-img/aichan-default.png" //REPLACE LATER--this is the default image in the animation window, should be Ai holding the banhammer + +//int player_atk = 64; //may seem little but. the whole point is to spam. also itll go up later +//int brick_atk = 1024; +int prome_atk = 256; +int prome_atk_time = 0.2; + +struct sp_attack { + int keybind; + char *keybind_str; + char *filename; + char *atkspritesheet; //spritesheet :D (320x240) + int animframes; //yeah default to 1 + float framelength; //in seconds + int atk; + float cooldown_left; + float cooldown_max; + int enabled; +}; //really shouldnt do this all in here but idc +static struct sp_attack skills[SKILLCOUNT] = { + { inputs[4], GetKeyName(inputs[4]), "dialogue-img/aichan-default.png", "dialogue-img/aichan-default.png", 1, 0.1, 64, 0, 0, 1} + { KEY_ONE, "1", "dialogue-img/brick.png", "img/brickatk/sheet.png", 3, 0.2, 1024,0,5,0}, +}; + + static struct dialogue dialogues[DLGCOUNT] = { {"It's time to have an epic idol fight!!", "Rozaliya", "dialogue-img/aichan-default.png", PINK}, {"Roza... is this really a good idea?", "Liliya", "dialogue-img/aichan-default.png", BLUE}, @@ -30,18 +61,21 @@ int current_dlg = 0; struct dialogue *pre_dialogue = dialogues; int pre_dialogue_count = 9; -struct dialogue *post_dialogue_win = dialogues+9; -int post_dialogue_win_count = 2; +struct dialogue *post_win_dialogue = dialogues+9; +int post_win_dialogue_count = 2; -int prome_hp = 262144; //2^18 -int player_hp = 524288; //2^19 +int prome_hp = PROMEMAXHP; //2^18 +int player_hp = PLAYERMAXHP; //2^19 int player_atk = 64; //may seem little but. the whole point is to spam. also itll go up later int brick_atk = 1024; int prome_atk = 256; int prome_atk_time = 0.2; +int brick_cooldown = 0; +//static functions +static int draw_fight_screen(void); int update_boss_screen(float delta) { @@ -61,7 +95,7 @@ int draw_boss_screen(void) switch (frozen) { case 1: //pre-fight dialogue drawdialogue(pre_dialogue+current_dlg); - if (IsKeyPressed(inputs[5])) { + if (IsKeyPressed(inputs[5]) || IsKeyPressed(inputs[4])) { if (++current_dlg >= pre_dialogue_count) { //dialogue over current_dlg = 0; frozen = 0; @@ -70,9 +104,18 @@ int draw_boss_screen(void) break; case 0: //fight + draw_fight_screen(); break; case 2: //post-fight-win dialogue + drawdialogue(post_win_dialogue+current_dlg); + if (IsKeyPressed(inputs[5]) || IsKeyPressed(inputs[4])) { + if (++current_dlg >= post_win_dialogue_count) { //dialogue over + current_dlg = 0; + frozen = 0; + mode = ENDSCREENMODE; + }; + }; break; case 3: //post-fight-lose dialogue @@ -80,3 +123,58 @@ int draw_boss_screen(void) }; return 1; }; + +static int draw_hp_bar(int hp, int max_hp, Vector2 position); +static int draw_enemy_img(char *filename); +static int draw_sp_attack(int cooldown_left, int cooldown_max, char *img_filename, char *keybind); + +static int draw_fight_screen(void) +{ + //so like draw the enemy display for a bit + DrawText("\"Context\"??:", 80,45,30,BLACK); //enemy name :) + draw_hp_bar(prome_hp,PROMEMAXHP, (Vector2){300,40}); + draw_enemy_img(PROMEIMGPATH); + + return 1; +}; + +static int draw_hp_bar(int hp, int max_hp, Vector2 pos) +{ + int percent = (float)hp/(float)max_hp * 100; + int hp_width = (float)hp/(float)max_hp * 300; + //ok so i think green for HP, red for used up HP, black for the border would be good? + Vector2 bar_size = {300,40}; + //draw the background + DrawRectangleV(pos, bar_size, RED); + //draw the hp the character has. i think. 3px/percentage btw + DrawRectangleV(pos, (Vector2){hp_width,40}, GREEN); + //draw the outline!! + DrawRectangleLinesEx((Rectangle){pos.x, pos.y, bar_size.x, bar_size.y}, 2, BLACK); + //draw + + return 1; +}; + +Texture2D txtr; + +static int draw_enemy_img(char *filename) +{ + static char *last_filename = ""; + if (filename != last_filename) { + printf("time to reimport the image"); + Image img = LoadImage(filename); + ImageResize(&img,280,360); + txtr = LoadTextureFromImage(img); + UnloadImage(img); + last_filename = filename; + }; + DrawTexture(txtr,0,120,WHITE); + return 1; +}; + +int fight_cleanup(void) +{ + UnloadTexture(txtr); + return 1; +}; + diff --git a/game.h b/game.h index c39054f..0148865 100644 --- a/game.h +++ b/game.h @@ -102,6 +102,7 @@ int is_killed(struct Rectangle *rect); int level_cleanup(void); int player_cleanup(void); +int fight_cleanup(void); int drawstartgame(void); int handlebuttons(void); diff --git a/img/brickatk/brick.aseprite b/img/brickatk/brick.aseprite new file mode 100644 index 0000000..f471261 Binary files /dev/null and b/img/brickatk/brick.aseprite differ diff --git a/img/brickatk/sheet.png b/img/brickatk/sheet.png new file mode 100644 index 0000000..2377ef9 Binary files /dev/null and b/img/brickatk/sheet.png differ diff --git a/img/coin_10_10.png b/img/coin_10_10.png new file mode 100644 index 0000000..7513ec4 Binary files /dev/null and b/img/coin_10_10.png differ diff --git a/level.c b/level.c index 47b5b15..692e482 100644 --- a/level.c +++ b/level.c @@ -232,7 +232,7 @@ int drawdialogueline(char *l) Texture2D coin_txtr; Sound coin_sound; -int cleanup_level(void) +int level_cleanup(void) { UnloadTexture(txtr); UnloadTexture(coin_txtr); diff --git a/main_v2.c b/main_v2.c index 62cf085..dee716d 100644 --- a/main_v2.c +++ b/main_v2.c @@ -65,7 +65,11 @@ int main(void) ZeichnenAufhören(); break; }; - } + }; + //cleanup stuff + level_cleanup(); + player_cleanup(); + fight_cleanup(); CloseWindow();