+7
-2
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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
@@ -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
@@ -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 ],
|
||||
|
||||
Reference in New Issue
Block a user