demo finish
This commit is contained in:
@@ -110,6 +110,7 @@ void Enemy::handlePlayerShoot(const PlayerShootAction& shootAction) {
|
||||
|
||||
if (isOnEnemy) {
|
||||
setMeshToSpawn();
|
||||
audio->adpcm.tryPlay(info.adpcmDeath, info.adpcmChannel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +145,7 @@ void Enemy::fight() {
|
||||
void Enemy::animationCallback(const AnimationSequenceCallback& callback) {
|
||||
if (callback == AnimationSequenceCallback::AnimationSequenceCallback_Loop) {
|
||||
if (isFighting) {
|
||||
audio->adpcm.tryPlay(info.adpcmSample, info.adpcmChannel);
|
||||
audio->adpcm.tryPlay(info.adpcmPunch, info.adpcmChannel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,14 +40,18 @@ EnemyManager::EnemyManager(Engine* engine, const Heightmap& heightmap) {
|
||||
clothTexture = textureRepo->add(
|
||||
FileUtils::fromCwd("game/models/zombie/ClothMaterial.png"));
|
||||
|
||||
auto* sample = engine->audio.adpcm.load(
|
||||
auto* punch = engine->audio.adpcm.load(
|
||||
FileUtils::fromCwd("game/models/zombie/punch.adpcm"));
|
||||
|
||||
auto* death = engine->audio.adpcm.load(
|
||||
FileUtils::fromCwd("game/models/zombie/death.adpcm"));
|
||||
|
||||
const int enemyCount = 10;
|
||||
for (int i = 0; i < enemyCount; i++) {
|
||||
EnemyInfo info;
|
||||
info.adpcmChannel = 9 + i;
|
||||
info.adpcmSample = sample;
|
||||
info.adpcmPunch = punch;
|
||||
info.adpcmDeath = death;
|
||||
info.motherMesh = motherMesh;
|
||||
info.clothTexture = clothTexture;
|
||||
info.bodyTexture = bodyTexture;
|
||||
|
||||
@@ -84,6 +84,7 @@ void GameState::update() {
|
||||
firstEnemyMesh->getModelMatrix()));
|
||||
renderer.add(hud->crosshairSprite.get());
|
||||
renderer.add(hud->hpSprite.get());
|
||||
renderer.add(hud->soldierSprite.get());
|
||||
}
|
||||
renderer.render();
|
||||
}
|
||||
|
||||
@@ -17,10 +17,18 @@ namespace Demo {
|
||||
Hud::Hud(TextureRepository* t_repo) {
|
||||
repo = t_repo;
|
||||
|
||||
soldierSprite = std::make_unique<Sprite>();
|
||||
soldierSprite->mode = Tyra::MODE_STRETCH;
|
||||
soldierSprite->size.set(64.0F, 64.0F);
|
||||
soldierSprite->position.set(5.0F, 448.0F - 64.0F - 5.0F);
|
||||
|
||||
soldierTexture = repo->add(FileUtils::fromCwd("game/soldier.png"));
|
||||
soldierTexture->addLink(soldierSprite->id);
|
||||
|
||||
hpSprite = std::make_unique<Sprite>();
|
||||
hpSprite->mode = Tyra::MODE_STRETCH;
|
||||
hpSprite->size.set(128.0F, 64.0F);
|
||||
hpSprite->position.set(0, 448.0F - 64.0F - 5.0F);
|
||||
hpSprite->position.set(70.0F, 448.0F - 64.0F - 5.0F);
|
||||
|
||||
hpTexture = repo->add(FileUtils::fromCwd("game/health_bar.png"));
|
||||
hpTexture->addLink(hpSprite->id);
|
||||
|
||||
Reference in New Issue
Block a user