Merge pull request #27 from CrystalPointA4/musicInclude

Music include
This commit is contained in:
2016-06-21 20:03:56 +02:00
committed by GitHub
13 changed files with 34 additions and 25 deletions
+7 -2
View File
@@ -7,18 +7,22 @@ Crystal::Crystal(const std::string & filled, const std::string & empty, const Ve
{
this->filled = Model::load(filled);
this->empty = Model::load(empty);
model = this->filled;
model = this->filled;
this->position = position;
this->rotation = rotation;
this->scale = scale;
this->canCollide = true;
isFilled = true;
sound_id = CrystalPoint::GetSoundSystem().LoadSound("WAVE/Crystal.wav", false);
music = CrystalPoint::GetSoundSystem().GetSound(sound_id);
music->SetPos(position, Vec3f());
}
Crystal::~Crystal()
{
CrystalPoint::GetSoundSystem().UnloadSound(sound_id);
if (model)
Model::unload(model);
@@ -41,6 +45,7 @@ void Crystal::collide()
{
if (isFilled)
{
music->Play();
Player::getInstance()->crystals++;
isFilled = false;
model = empty;
+3
View File
@@ -1,6 +1,7 @@
#pragma once
#include "Entity.h"
#include <string>
#include "CrystalPoint.h"
class Crystal :
public Entity
@@ -14,6 +15,8 @@ public:
void draw();
void collide();
private:
int sound_id;
Sound* music;
Model* filled;
Model* empty;
};
+4 -2
View File
@@ -230,8 +230,10 @@
<None Include="worlds\worlds.json" />
</ItemGroup>
<ItemGroup>
<Media Include="WAVE\bond.wav" />
<Media Include="WAVE\Sound.wav" />
<Media Include="WAVE\Crystal.wav" />
<Media Include="WAVE\ghostEnemy.wav" />
<Media Include="WAVE\portal.wav" />
<Media Include="WAVE\world1.wav" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
+8 -2
View File
@@ -243,10 +243,16 @@
</None>
</ItemGroup>
<ItemGroup>
<Media Include="WAVE\Sound.wav">
<Media Include="WAVE\Crystal.wav">
<Filter>Resource Files</Filter>
</Media>
<Media Include="WAVE\bond.wav">
<Media Include="WAVE\portal.wav">
<Filter>Resource Files</Filter>
</Media>
<Media Include="WAVE\ghostEnemy.wav">
<Filter>Resource Files</Filter>
</Media>
<Media Include="WAVE\world1.wav">
<Filter>Resource Files</Filter>
</Media>
</ItemGroup>
+2 -10
View File
@@ -34,11 +34,10 @@ Enemy::Enemy(const std::string &fileName,
Enemy::~Enemy()
{
music->Stop();
CrystalPoint::GetSoundSystem().UnloadSound(hit_sound_id);
if (model)
Model::unload(model);
CrystalPoint::GetSoundSystem().UnloadSound(hit_sound_id);
}
void Enemy::draw()
@@ -114,14 +113,7 @@ void Enemy::update(float delta)
else
{
attack = true;
if (music->IsPlaying() == true)
{
// music->Pause();
music->Stop();
}
}
rotation.y = atan2f(dx, dz) * 180 / M_PI;
}
}
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
+1
View File
@@ -327,6 +327,7 @@ void World::update(float elapsedTime)
if (remove)
{
delete enemies[count];
player->XpUp(enemies[count]->xp);
enemies.erase(enemies.begin() + count);
player->HpUp(10);
+5 -5
View File
@@ -3,7 +3,7 @@
"heightmap": "worlds/rockHeightmap.png",
"texture": "worlds/rockStone2.png",
"skybox": "skyboxes/water/",
"music": "WAVE/test2.wav",
"music": "WAVE/world1.wav",
"object-templates": [
{
"color": 50,
@@ -92,10 +92,10 @@
},
"enemies": [
{
"file": "models/squid/Blooper.obj",
"pos": [ 20, 5, 10 ],
"scale": 0.01,
"music": "WAVE/enemy.wav"
"file": "models/squid/Blooper.obj",
"pos": [ 30, 10, 10 ],
"scale": 0.01,
"music": "WAVE/ghostEnemy.wav"
}],
"crystal": {
"full texture": "models/crystal/Crystal.obj",
+4 -4
View File
@@ -9,7 +9,7 @@
"collision": true
}
],
"music": "WAVE/test1.wav"
"music": "WAVE/world1.wav"
},
"player": {
"startposition": [ 20, 0, 20 ]
@@ -24,7 +24,7 @@
"file": "models/squid/Blooper.obj",
"pos": [ 20, 5, 10 ],
"scale": 0.01,
"music": "WAVE/enemy.wav",
"music": "WAVE/ghostEnemy.wav"
"health": 10,
"damage": 2
},
@@ -32,13 +32,13 @@
"file": "models/squid/Blooper.obj",
"pos": [ 30, 10, 10 ],
"scale": 0.01,
"music": "WAVE/enemy.wav",
"music": "WAVE/ghostEnemy.wav"
"health": 15,
"damage": 2
}],
"crystal": {
"full texture": "models/crystal/Crystal.obj",
"empty texture": "models/crystal/PickedUpCrystal.obj",
"empty texture": "models/crystal/PickedUpCrystal.obj",
"instances": [
{
"pos": [ 31, 5, 33 ],