added sound effects

This commit is contained in:
Return0ne 2021-11-29 11:03:12 -05:00
parent 02bc8500aa
commit 6987f4c2a5
5 changed files with 15 additions and 7 deletions

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
assets/sfx/hit.wav Normal file

Binary file not shown.

View File

@ -5,10 +5,10 @@
#include "Debug.h" #include "Debug.h"
#include "Copying.h" #include "Copying.h"
// Functions /* Functions */
// Globles /* Globles */
// Position Varaibles // Position Varaibles
float EnemyPos_x = 482.0f, EnemyPos_y = 62.0f; float EnemyPos_x = 482.0f, EnemyPos_y = 62.0f;
@ -26,16 +26,19 @@ void Setup()
InitWindow(screenWidth, screenHeight, "Tux Vs Windows"); InitWindow(screenWidth, screenHeight, "Tux Vs Windows");
InitAudioDevice();
SetTargetFPS(60); SetTargetFPS(60);
} }
// GameLoop Code // GameLoop Code
void MainGameLoop() void MainGameLoop()
{ {
// Load Textures // Load Assets
Texture2D tux = LoadTexture("assets/tux.png"); Texture2D tux = LoadTexture("assets/gfx/tux.png");
Texture2D enemy = LoadTexture("assets/enemy.png"); Texture2D enemy = LoadTexture("assets/gfx/enemy.png");
Texture2D arctic = LoadTexture("assets/arctic.png"); Texture2D arctic = LoadTexture("assets/gfx/arctic.png");
Sound sfxHit = LoadSound("assets/sfx/hit.wav");
// Hitboxes // Hitboxes
Rectangle EnemyHitbox = { GetScreenWidth()/2.0f - 30, GetScreenHeight()/2.0f - 30, 290, 300}; Rectangle EnemyHitbox = { GetScreenWidth()/2.0f - 30, GetScreenHeight()/2.0f - 30, 290, 300};
@ -77,6 +80,7 @@ void MainGameLoop()
if (collision) { if (collision) {
DrawText("FINALY BASIC AWFUL COLLISION", 50, 18, 20, MAROON); DrawText("FINALY BASIC AWFUL COLLISION", 50, 18, 20, MAROON);
PlaySound(sfxHit);
} else { } else {
DrawText("Tux Vs X ENGINE PROTOTYPE please read the LINCENSE", 50, 18, 20, BLACK); DrawText("Tux Vs X ENGINE PROTOTYPE please read the LINCENSE", 50, 18, 20, BLACK);
} }
@ -86,17 +90,21 @@ void MainGameLoop()
EndDrawing(); EndDrawing();
} }
// Unload Textures // Unload Assets
UnloadTexture(tux); UnloadTexture(tux);
UnloadTexture(enemy); UnloadTexture(enemy);
UnloadTexture(arctic); UnloadTexture(arctic);
UnloadSound(sfxHit);
} }
int main() int main()
{ {
Setup(); Setup();
MainGameLoop(); MainGameLoop();
CloseAudioDevice();
CloseWindow(); CloseWindow();
License(); License();
return 0; return 0;