sounds: added battle sounds, ui sounds coming soon
This commit is contained in:
parent
d9c1ee9faa
commit
349cae54b3
13 changed files with 51 additions and 9 deletions
BIN
assets/sounds/block1.wav
Normal file
BIN
assets/sounds/block1.wav
Normal file
Binary file not shown.
BIN
assets/sounds/block2.wav
Normal file
BIN
assets/sounds/block2.wav
Normal file
Binary file not shown.
BIN
assets/sounds/block3.wav
Normal file
BIN
assets/sounds/block3.wav
Normal file
Binary file not shown.
BIN
assets/sounds/dodge1.wav
Normal file
BIN
assets/sounds/dodge1.wav
Normal file
Binary file not shown.
BIN
assets/sounds/dodge2.wav
Normal file
BIN
assets/sounds/dodge2.wav
Normal file
Binary file not shown.
BIN
assets/sounds/dodge3.wav
Normal file
BIN
assets/sounds/dodge3.wav
Normal file
Binary file not shown.
BIN
assets/sounds/sword1.wav
Normal file
BIN
assets/sounds/sword1.wav
Normal file
Binary file not shown.
BIN
assets/sounds/sword2.wav
Normal file
BIN
assets/sounds/sword2.wav
Normal file
Binary file not shown.
BIN
assets/sounds/sword3.wav
Normal file
BIN
assets/sounds/sword3.wav
Normal file
Binary file not shown.
BIN
assets/sounds/uiclick1.wav
Normal file
BIN
assets/sounds/uiclick1.wav
Normal file
Binary file not shown.
BIN
assets/sounds/uiclick2.wav
Normal file
BIN
assets/sounds/uiclick2.wav
Normal file
Binary file not shown.
38
src/audio.c
38
src/audio.c
|
|
@ -72,7 +72,24 @@ void audio_play_move(void) {
|
||||||
|
|
||||||
void audio_play_attack(void) {
|
void audio_play_attack(void) {
|
||||||
// Mid-range hit sound
|
// Mid-range hit sound
|
||||||
play_tone(400.0f, 0.1f, 0.5f);
|
// play_tone(400.0f, 0.1f, 0.5f);
|
||||||
|
int choice = GetRandomValue(1, 3);
|
||||||
|
Sound attack;
|
||||||
|
switch (choice) {
|
||||||
|
case 1:
|
||||||
|
attack = LoadSound("./assets/sounds/sword1.wav");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
attack = LoadSound("./assets/sounds/sword2.wav");
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
attack = LoadSound("./assets/sounds/sword3.wav");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
attack = LoadSound("./assets/sounds/sword1.wav");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
PlaySound(attack);
|
||||||
}
|
}
|
||||||
|
|
||||||
void audio_play_item_pickup(void) {
|
void audio_play_item_pickup(void) {
|
||||||
|
|
@ -100,7 +117,24 @@ void audio_play_stairs(void) {
|
||||||
|
|
||||||
void audio_play_dodge(void) {
|
void audio_play_dodge(void) {
|
||||||
// High-pitched whoosh
|
// High-pitched whoosh
|
||||||
play_tone(900.0f, 0.08f, 0.3f);
|
// play_tone(900.0f, 0.08f, 0.3f);
|
||||||
|
int choice = GetRandomValue(1, 3);
|
||||||
|
Sound dodge;
|
||||||
|
switch (choice) {
|
||||||
|
case 1:
|
||||||
|
dodge = LoadSound("./assets/sounds/dodge1.wav");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
dodge = LoadSound("./assets/sounds/dodge2.wav");
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
dodge = LoadSound("./assets/sounds/dodge3.wav");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
dodge = LoadSound("./assets/sounds/dodge1.wav");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
PlaySound(dodge);
|
||||||
}
|
}
|
||||||
|
|
||||||
void audio_play_block(void) {
|
void audio_play_block(void) {
|
||||||
|
|
|
||||||
22
src/main.c
22
src/main.c
|
|
@ -65,12 +65,18 @@ static void spawn_floating_label(GameState *gs, int x, int y, const char *label,
|
||||||
|
|
||||||
static const char *proc_label_for(StatusEffectType effect) {
|
static const char *proc_label_for(StatusEffectType effect) {
|
||||||
switch (effect) {
|
switch (effect) {
|
||||||
case EFFECT_POISON: return "POISON!";
|
case EFFECT_POISON:
|
||||||
case EFFECT_BLEED: return "BLEED!";
|
return "POISON!";
|
||||||
case EFFECT_BURN: return "BURN!";
|
case EFFECT_BLEED:
|
||||||
case EFFECT_STUN: return "STUN!";
|
return "BLEED!";
|
||||||
case EFFECT_WEAKEN: return "WEAKEN!";
|
case EFFECT_BURN:
|
||||||
default: return "";
|
return "BURN!";
|
||||||
|
case EFFECT_STUN:
|
||||||
|
return "STUN!";
|
||||||
|
case EFFECT_WEAKEN:
|
||||||
|
return "WEAKEN!";
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -185,6 +191,7 @@ static void post_action(GameState *gs, Enemy *attacked_enemy) {
|
||||||
} else {
|
} else {
|
||||||
if (combat_get_last_damage() > 0)
|
if (combat_get_last_damage() > 0)
|
||||||
spawn_floating_text(gs, ex, ey, combat_get_last_damage(), combat_was_critical());
|
spawn_floating_text(gs, ex, ey, combat_get_last_damage(), combat_was_critical());
|
||||||
|
audio_play_attack();
|
||||||
if (combat_was_blocked()) {
|
if (combat_was_blocked()) {
|
||||||
spawn_floating_label(gs, ex, ey - 10, "BLOCK", EFFECT_NONE);
|
spawn_floating_label(gs, ex, ey - 10, "BLOCK", EFFECT_NONE);
|
||||||
audio_play_block();
|
audio_play_block();
|
||||||
|
|
@ -553,7 +560,8 @@ static void game_loop(void) {
|
||||||
int main(void) {
|
int main(void) {
|
||||||
// Initialize audio
|
// Initialize audio
|
||||||
audio_init();
|
audio_init();
|
||||||
|
// Initialize random number generator
|
||||||
|
SetRandomSeed(88435);
|
||||||
// Initialize window
|
// Initialize window
|
||||||
InitWindow(SCREEN_WIDTH, SCREEN_HEIGHT + 60, "Roguelike");
|
InitWindow(SCREEN_WIDTH, SCREEN_HEIGHT + 60, "Roguelike");
|
||||||
SetTargetFPS(60);
|
SetTargetFPS(60);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue