Skip to content
This repository has been archived by the owner on Jul 6, 2021. It is now read-only.

Commit

Permalink
Weapon Charging Sound
Browse files Browse the repository at this point in the history
Now the sound stops when you release the key early enough for the weapon not to be charged.
  • Loading branch information
ch0m5 committed May 7, 2018
1 parent e4609ff commit 2b71481
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
9 changes: 6 additions & 3 deletions Andro_Dunos/ModulePlayer1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -882,13 +882,13 @@ update_status ModulePlayer1::Update() // Moves the ship and changes it's printed
currentYellow++;

// Charging weapon sounds
if (bluePower > LEVEL_1 && weaponChargeTimer < SDL_GetTicks() - 1700 && weaponChargingStage == NOT_CHARGING)
if (bluePower > LEVEL_1 && weaponChargeTimer < SDL_GetTicks() - 1300 && weaponChargingStage == NOT_CHARGING)
{
Mix_PlayChannel(1, typeCharging, 0);
weaponChargingStage = CHARGING;
}

if (bluePower > LEVEL_1 && weaponChargeTimer < SDL_GetTicks() - 4800 && weaponChargingStage == CHARGING)
if (bluePower > LEVEL_1 && weaponChargeTimer < SDL_GetTicks() - 4400 && weaponChargingStage == CHARGING)
{
Mix_PlayChannel(1, typeCharged, -1);
weaponChargingStage = CHARGED;
Expand All @@ -900,7 +900,7 @@ update_status ModulePlayer1::Update() // Moves the ship and changes it's printed
{
weaponChargingStage = NOT_CHARGING;

if (weaponChargeTimer < SDL_GetTicks() - 2000 && bluePower > LEVEL_1)
if (weaponChargeTimer < SDL_GetTicks() - 2200 && bluePower > LEVEL_1)
{
switch (type)
{
Expand Down Expand Up @@ -967,6 +967,9 @@ update_status ModulePlayer1::Update() // Moves the ship and changes it's printed

bluePower--;
}

else if (weaponChargeTimer < SDL_GetTicks() - 1300 && bluePower > LEVEL_1)
Mix_HaltChannel(1);
}

//GodMode Function
Expand Down
9 changes: 6 additions & 3 deletions Andro_Dunos/ModulePlayer2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -879,13 +879,13 @@ update_status ModulePlayer2::Update() // Moves the ship and changes it's printed
currentYellow++;

// Charging weapon sounds
if (bluePower > LEVEL_1 && weaponChargeTimer < SDL_GetTicks() - 1700 && weaponChargingStage == NOT_CHARGING)
if (bluePower > LEVEL_1 && weaponChargeTimer < SDL_GetTicks() - 1300 && weaponChargingStage == NOT_CHARGING)
{
Mix_PlayChannel(3, typeCharging, 0);
weaponChargingStage = CHARGING;
}

if (bluePower > LEVEL_1 && weaponChargeTimer < SDL_GetTicks() - 4800 && weaponChargingStage == CHARGING)
if (bluePower > LEVEL_1 && weaponChargeTimer < SDL_GetTicks() - 4400 && weaponChargingStage == CHARGING)
{
Mix_PlayChannel(3, typeCharged, -1);
weaponChargingStage = CHARGED;
Expand All @@ -897,7 +897,7 @@ update_status ModulePlayer2::Update() // Moves the ship and changes it's printed
{
weaponChargingStage = NOT_CHARGING;

if (weaponChargeTimer < SDL_GetTicks() - 2000 && bluePower > LEVEL_1)
if (weaponChargeTimer < SDL_GetTicks() - 2200 && bluePower > LEVEL_1)
{
switch (type)
{
Expand Down Expand Up @@ -964,6 +964,9 @@ update_status ModulePlayer2::Update() // Moves the ship and changes it's printed

bluePower--;
}

else if (weaponChargeTimer < SDL_GetTicks() - 1300 && bluePower > LEVEL_1)
Mix_HaltChannel(3);
}

//GodMode Function
Expand Down

0 comments on commit 2b71481

Please sign in to comment.