@@ -127,8 +127,19 @@ class Player {
|
||||
}
|
||||
}
|
||||
|
||||
void updateWeapon(int currentTime) {
|
||||
/// Returns true only on the specific frame where the hit should be calculated
|
||||
bool updateWeapon(int currentTime) {
|
||||
int oldFrame = currentWeapon.frameIndex;
|
||||
currentWeapon.update(currentTime);
|
||||
|
||||
// In your Pistol (Indices 212-215), Index 213 is the flash.
|
||||
// This translates to frameIndex == 1 in our fireFrames list.
|
||||
if (currentWeapon.state == WeaponState.firing &&
|
||||
oldFrame == 0 &&
|
||||
currentWeapon.frameIndex == 1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Logic to switch weapons (e.g., picking up the Machine Gun)
|
||||
|
||||
Reference in New Issue
Block a user