basic sound support and added some rocking sounds

This commit is contained in:
2010-10-18 00:40:50 +02:00
parent e73b330429
commit 9809a7318b
10 changed files with 314 additions and 5 deletions
+13
View File
@@ -62,11 +62,22 @@ int Model::OnInit (int argc, char* argv[]) {
mPlayerName = "Player";
Engine::PlayMusic ("./data/sounds/intro_music.ogg");
Engine::RegisterListener (this, EventAccelerateStart);
Engine::RegisterListener (this, EventAccelerateStop);
return result;
}
bool Model::OnReceiveEvent (const Engine::EventBasePtr &event) {
switch (event->mEventType) {
case EventAccelerateStart:
Engine::PlaySoundLoop("./data/sounds/thrust.wav", -1);
break;
case EventAccelerateStop:
Engine::HaltSoundLoop("./data/sounds/thrust.wav");
break;
case EventLevelComplete:
return OnLevelComplete();
break;
@@ -415,6 +426,8 @@ void Model::OnKillEntity (const Engine::EntityBase *entity) {
GameEntityType entity_type = (GameEntityType) entity->mType;
if (entity_type == GameEntityTypeAsteroid) {
Engine::PlaySound("./data/sounds/rock_destroyed.wav");
unsigned int i;
const AsteroidEntity *asteroid = static_cast<const AsteroidEntity*>(entity);
mPoints += 150 + asteroid->mSubAsteroidsCount * 75;
+2
View File
@@ -126,6 +126,8 @@ void ShipEntity::Attack () {
rocket_physics->mOrientation = entity_physic->mOrientation;
rocket_physics->mVelocity = attack_dir.normalize();
rocket_physics->mVelocity *= ShipEntity::VarMaxSpeed.GetFloatValue() + 0.5;
Engine::PlaySound ("./data/sounds/laser.wav");
}
}