#define PLAYERMAXHP 524288
#define PROMEIMGPATH "dialogue-img/aichan-default.png" //REPLACE LATER!!
#define BRICKCOOLDOWNFULL 5
-#define SKILLCOUNT 1
+#define SKILLCOUNT 2
+#define ENEMYSKILLCOUNT 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
+#define PLAYERIMGWIDTH 320
+#define PLAYERIMGHEIGHT 240
+
//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 prome_atk = 256;
+//int prome_atk_time = 0.2;
+
+int curr_enemy_attack = -1; //-1 for no attack, then the index in enemy_skills[]
+int enemy_img_time_shown = 0; //the time the current image has been shown; only relevant if curr_enemy_attack > 0 so it goes back to the original image
+Texture2D enemy_img_txtr; //just for like easy
+
+int curr_player_attack = -1; //-1 for no attack, then the index in skills[]; important to note that it only switches back once the animation is over; if the player is spamming enough it should stay pretty long at 0 but each time the "animation" is restarted
+int player_img_time_shown = 0; //restarts at new frame lol
+int player_img_frame = 0; //only relevant for animations ig
+Texture2D player_img_txtr;
+
+//the "update" function is the only one with access to delta, so all of the updating should be done there and then draw should draw based on variables set in "update"
struct sp_attack {
int keybind;
float cooldown_max;
int enabled;
};
+
+struct enemy_attack {
+ char *enemy_attack_img;
+ char *name;
+ 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}
+ { inputs[4], GetKeyName(inputs[4]), "dialogue-img/aichan-default.png", "dialogue-img/aichan-default.png", 1, 0.0333, 64, 0, 0, 1}
{ KEY_ONE, "1", "dialogue-img/brick.png", "img/brickatk/sheet.png", 3, 0.2, 1024,0,5,0},
};
+static struct enemy_attack enemy_skills[ENEMYSKILLCOUNT] = {
+ { "dialogue-img/aichan-default.png", "attack!", 256, 0, 0.2, 1}
+};
+
static struct dialogue dialogues[DLGCOUNT] = {
{"It's time to have an epic idol fight!!", "Rozaliya", "dialogue-img/aichan-default.png", PINK},
//static functions
static int draw_fight_screen(void);
+static int update_cooldowns(float delta); //also updates animation shown times lol
+static int get_player_attack(void);
+static int get_enemy_attack(void);
+static int update_player_texture(void);
+static int update_enemy_texture(void);
+
int update_boss_screen(float delta)
{
switch (frozen) {
case 0:
- //normal gameplay
+ update_cooldowns(delta);
+ curr_player_attack = get_player_attack();
+ curr_enemy_attack = get_enemy_attack();
+
break;
default:
//nothing?
return 1;
};
+
+static int update_player_texture(void)
+{
+ static char *last_player_texture = "";
+ static int last_player_frame = 0;
+ //get player frame + animation
+ char *player_img_name = "";
+ int player_frame;
+ if (curr_player_attack == -1) { //no attack shown rn
+ player_img_name = DEFAULTANIMFRAME;
+ } else if (curr_player_attack < SKILLCOUNT) {
+ //check if a new frame needs to be started/the animation ended
+ //either end the animation and set it to the default or set time_shown to 0 and frame++
+ //then put the new frame into player_img_name
+ } else { //curr_player_attack is not an existing attack??
+ printf("bad error happen :( sad\n");
+ return 0;
+ };
+
+ if ((last_player_texture != player_img_name) || (last_player_frame != player_frame)) { //texture not loaded
+ last_player_texture = player_img_name;
+ Image img = LoadImage(player_img_name);
+ ImageCrop(&img, (Rectangle){(PLAYERIMGWIDTH*player_frame), 0, PLAYERIMGWIDTH, PLAYERIMGHEIGHT});
+ player_img_txtr = LoadTextureFromImage(img);
+ UnloadImage(img);
+ };
+};
+
+static int update_cooldowns(float d)
+{
+ //SKILL COOLDOWNS
+ //first player ones
+ for (int i = 0; i < SKILLCOUNT; i++) {
+ skills[i].cooldown_left -= d;
+ };
+ //then enemy ones
+ for (int i = 0; i < ENEMYSKILLCOUNT; i++) {
+ enemy_skills[i].cooldown_left -= d;
+ };
+
+ //ANIMATION SHOWN LENGTHS
+ player_img_time_shown += d;
+ enemy_img_time_shown += d;
+ return 1;
+};
+
+static int get_player_attack(void)
+{
+ int k;
+ while ((k = GetKeyPressed()) != 0) {
+ for (int i = 0; i < SKILLCOUNT; i++) {
+ if ((k == skills[i].keycode) && (skills[i].cooldown_left <= 0)) {
+ //new attack so reset all of the animation and stuff
+ player_img_time_shown = 0;
+ player_img_frame = 0;
+ skills[i].cooldown_left = skills[i].cooldown_max;
+ return i;
+ };
+ };
+ };
+ return curr_player_attack;
+};
+
+static int get_enemy_attack(void)
+{
+ for (int i = ENEMYSKILLCOUNT - 1; i > -1; i--) { //start from the bottom just so later added ones are more important (presumably more powerful)
+ if (enemy_skills[i].cooldown_left <= 0) {
+ //new attack so reset all of the animation and stuff
+ enemy_img_time_shown = 0;
+ enemy_skills[i].cooldown_left = enemy_skills[i].cooldown_max;
+ return i;
+ };
+ };
+ return curr_enemy_attack; //if nothing happens we want to just return the old one lol so nothing changes
+};
+
int draw_boss_screen(void)
{
switch (frozen) {