add cooldown to player skills
This commit is contained in:
parent
f5a9d796be
commit
e748684e08
20
src/main.c
20
src/main.c
|
@ -134,7 +134,14 @@ int main(void)
|
|||
player_f->enemy_data = NULL;
|
||||
/* F1: Dash */
|
||||
player_f->actions_cooldown_total[1] = fix(1.0);
|
||||
player_f->actions_cooldown[1] = fix(0.0);
|
||||
/* F2: Shock */
|
||||
player_f->actions_cooldown_total[2] = fix(4.0);
|
||||
/* F3: Judgement */
|
||||
player_f->actions_cooldown_total[3] = fix(3.0);
|
||||
/* F4: Bullet */
|
||||
player_f->actions_cooldown_total[4] = fix(4.0);
|
||||
for(int i = 0; i < 5; i++)
|
||||
player_f->actions_cooldown[1] = fix(0.0);
|
||||
/* Initialize stats. This will level up to level 1 */
|
||||
player_add_xp(&player_data, 0);
|
||||
player_f->HP = player_f->HP_max;
|
||||
|
@ -514,7 +521,7 @@ int main(void)
|
|||
bool can_attack = player_f->HP > 0 && !player_f->current_attack &&
|
||||
!keydown(KEY_VARS);
|
||||
|
||||
if(can_attack && keydown(KEY_F2)) {
|
||||
if(can_attack && keydown(KEY_F2) && !player_f->actions_cooldown[2]) {
|
||||
entity_t *aoe = aoe_make_attack_4(AOE_SHOCK, player,
|
||||
player_p->facing);
|
||||
game_add_entity(&game, aoe);
|
||||
|
@ -522,10 +529,11 @@ int main(void)
|
|||
visible_set_anim(player, &anims_player_Attack, 2);
|
||||
player_f->current_attack = aoe;
|
||||
player_f->attack_follows_movement = true;
|
||||
player_f->actions_cooldown[2]=player_f->actions_cooldown_total[2];
|
||||
|
||||
game_shake(&game, 5, fix(0.7));
|
||||
}
|
||||
if(can_attack && keydown(KEY_F3)) {
|
||||
if(can_attack && keydown(KEY_F3) && !player_f->actions_cooldown[3]) {
|
||||
entity_t *aoe = aoe_make_attack_4( AOE_JUDGEMENT, player,
|
||||
player_p->facing);
|
||||
game_add_entity(&game, aoe);
|
||||
|
@ -533,10 +541,11 @@ int main(void)
|
|||
visible_set_anim(player, &anims_player_Attack, 2);
|
||||
player_f->current_attack = aoe;
|
||||
player_f->attack_follows_movement = false;
|
||||
player_f->actions_cooldown[3]=player_f->actions_cooldown_total[3];
|
||||
|
||||
game_shake(&game, 3, fix(1.3));
|
||||
}
|
||||
if(can_attack && keydown(KEY_F4)) {
|
||||
if(can_attack && keydown(KEY_F4) && !player_f->actions_cooldown[4]) {
|
||||
entity_t *aoe = aoe_make_attack_4(AOE_BULLET, player,
|
||||
player_p->facing);
|
||||
game_add_entity(&game, aoe);
|
||||
|
@ -544,6 +553,7 @@ int main(void)
|
|||
visible_set_anim(player, &anims_player_Attack, 2);
|
||||
player_f->current_attack = aoe;
|
||||
player_f->attack_follows_movement = false;
|
||||
player_f->actions_cooldown[4]=player_f->actions_cooldown_total[4];
|
||||
}
|
||||
|
||||
/* Ideas for additional skills:
|
||||
|
@ -551,7 +561,7 @@ int main(void)
|
|||
- Barrier around player
|
||||
- Teleport
|
||||
- Time manipulation
|
||||
- Player buffs (short but strong) or wide area debuggs
|
||||
- Player buffs (short but strong) or wide area debuffs
|
||||
Ideas for items:
|
||||
- Healing potion
|
||||
- Equipment
|
||||
|
|
Loading…
Reference in New Issue