diff --git a/CrystalPoint.vcxproj b/CrystalPoint.vcxproj
index e9dff21..6435a83 100644
--- a/CrystalPoint.vcxproj
+++ b/CrystalPoint.vcxproj
@@ -222,6 +222,7 @@
+
diff --git a/CrystalPoint.vcxproj.filters b/CrystalPoint.vcxproj.filters
index 902a3bc..84737cb 100644
--- a/CrystalPoint.vcxproj.filters
+++ b/CrystalPoint.vcxproj.filters
@@ -238,6 +238,9 @@
Source Files\json
+
+ Source Files\json
+
diff --git a/Enemy.cpp b/Enemy.cpp
index 0368ba9..e8bc92c 100644
--- a/Enemy.cpp
+++ b/Enemy.cpp
@@ -7,6 +7,8 @@
Enemy::Enemy(const std::string &fileName,
const std::string &fileMusic,
+ float damage,
+ float health,
const Vec3f &position,
const Vec3f &rotation,
const float &scale)
@@ -19,7 +21,11 @@ Enemy::Enemy(const std::string &fileName,
target = position;
speed = 1;
radius = 10;
- xp = 10;
+
+ xp = health;
+ this->health = health;
+ this->damage = damage;
+
hasTarget = false;
hit_sound_id = CrystalPoint::GetSoundSystem().LoadSound(fileMusic.c_str(), false);
music = CrystalPoint::GetSoundSystem().GetSound(hit_sound_id);
diff --git a/Enemy.h b/Enemy.h
index cf9d301..3ba5cb1 100644
--- a/Enemy.h
+++ b/Enemy.h
@@ -8,7 +8,7 @@
class Enemy : public Entity
{
public:
- Enemy(const std::string &fileName, const std::string &fileMusic, const Vec3f &position, const Vec3f &rotation, const float &scale);
+ Enemy(const std::string &fileName, const std::string &fileMusic, float damage, float health, const Vec3f &position, const Vec3f &rotation, const float &scale);
~Enemy();
Sound* music;
@@ -16,6 +16,8 @@ public:
bool hasTarget;
Vec3f target;
float speed,radius;
+ float health;
+ float damage;
int xp;
bool attack;
diff --git a/World.cpp b/World.cpp
index adbd7f2..b3321ac 100644
--- a/World.cpp
+++ b/World.cpp
@@ -126,12 +126,20 @@ World::World(const std::string &fileName)
if (e["music"].isNull())
std::cout << "Invalid world file: enemies music - " << fileName << "\n";
+ //Damage
+ if (e["damage"].isNull())
+ std::cout << "Invalid world file: enemies damage - " << fileName << "\n";
+
+ //Health
+ if (e["health"].isNull())
+ std::cout << "Invalid world file: enemies health - " << fileName << "\n";
+
//Create
Vec3f position(e["pos"][0].asFloat(), e["pos"][1].asFloat(), e["pos"][2].asFloat());
position.y = getHeight(position.x, position.z) + 2.0f;
maxEnemies++;
- enemies.push_back(new Enemy(e["file"].asString(), e["music"].asString(), position, rotation, scale));
+ enemies.push_back(new Enemy(e["file"].asString(), e["music"].asString(), e["damage"].asFloat(), e["health"].asFloat(), position, rotation, scale));
}
maxCrystals = 0;
if (!v["crystal"].isNull())
diff --git a/weapons.json b/weapons.json
new file mode 100644
index 0000000..1056000
--- /dev/null
+++ b/weapons.json
@@ -0,0 +1,40 @@
+{
+ "weapons": [
+ {
+ "name": "Fire reaper",
+ "damage": 1,
+ "element": "fire",
+ "file": "models/weapons/ZwaardMetTextures/TextureZwaard.obj",
+
+ "anchor": [ -2.0, 6.0, -2.1 ],
+ "collision": [ 0, 0, 0 ],
+ "maxRotation": [ 170, 70 ],
+ "minRotation": [ 20, -80 ],
+
+ "left": {
+ "offset": [ 4.5, -8, -1 ]
+ },
+ "right": {
+ "offset": [ 0.5, -8, -1 ]
+ }
+ },
+ {
+ "name": "Ice breaker",
+ "damage": 2,
+ "element": "ice",
+ "file": "models/weapons/ZwaardMetTextures/TextureZwaard.obj",
+
+ "anchor": [ -2.0, 6.0, -2.1 ],
+ "collision": [ 0, 0, 0 ],
+ "maxRotation": [ 170, 70 ],
+ "minRotation": [ 20, -80 ],
+
+ "left": {
+ "offset": [ 4.5, -8, -1 ]
+ },
+ "right": {
+ "offset": [ 0.5, -8, -1 ]
+ }
+ }
+ ]
+}
\ No newline at end of file