enemy walking around world

This commit is contained in:
Remco
2016-06-03 13:58:07 +02:00
parent b827885f40
commit 293ceb0b9f
3 changed files with 12 additions and 3 deletions
+1 -1
View File
@@ -80,7 +80,7 @@ void Enemy::update(float delta)
dz = target.z - position.z; dz = target.z - position.z;
length = sqrt(dx*dx + dz*dz); length = sqrt(dx*dx + dz*dz);
if (length > 0.03) if (length > 1)
{ {
dx /= length; dx /= length;
dz /= length; dz /= length;
+3
View File
@@ -6,6 +6,7 @@
#include "CrystalPoint.h" #include "CrystalPoint.h"
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include "WorldHandler.h"
World::World(const std::string &fileName) World::World(const std::string &fileName)
{ {
@@ -181,6 +182,8 @@ void World::update(float elapsedTime)
} }
} }
} }
WorldHandler* worldhandler = WorldHandler::getInstance();
enemy->position.y = worldhandler->getHeight(enemy->position.x, enemy->position.z) + 2.0f;
//tot hier //tot hier
} }
} }
+8 -2
View File
@@ -5,7 +5,7 @@
{ {
"color":100, "color":100,
"file": "models/boom/Boom.obj", "file": "models/boom/Boom.obj",
"collision": false "collision": true
} }
] ]
}, },
@@ -13,5 +13,11 @@
"startposition": [ 20, 5, 20 ] "startposition": [ 20, 5, 20 ]
}, },
"objects": [], "objects": [],
"enemies": [] "enemies": [
{
"file": "models/squid/Blooper.obj",
"pos": [ 20, 5, 10 ],
"scale": 0.01
}
]
} }