shoot action in demo

This commit is contained in:
h4570
2022-08-14 20:20:56 +02:00
parent 6e5b75e39b
commit 65f40091db
4 changed files with 38 additions and 21 deletions
+11 -6
View File
@@ -77,10 +77,10 @@ u8 Weapon::getShootChannel() {
}
void Weapon::update() {
isShooting = false;
if (!isShootAnimation1 && !isShootAnimation2 && pad->getPressed().Cross) {
shootTimer.prime();
audio->adpcm.tryPlay(shootAdpcm, getShootChannel());
isShootAnimation1 = true;
shoot();
}
auto* position = mesh->getPosition();
@@ -105,14 +105,19 @@ void Weapon::update() {
isShootAnimation2 = false;
*position = initialPosition;
if (pad->getPressed().Cross) {
shootTimer.prime();
audio->adpcm.tryPlay(shootAdpcm, getShootChannel());
isShootAnimation1 = true;
shoot();
}
}
}
}
void Weapon::shoot() {
isShooting = true;
shootTimer.prime();
audio->adpcm.tryPlay(shootAdpcm, getShootChannel());
isShootAnimation1 = true;
}
void Weapon::allocateOptions() {
options = new StaPipOptions();
options->textureMappingType = Tyra::TyraNearest;