]> git.localhorst.tv Git - orbi.git/blobdiff - src/orbi.cpp
orientation for entities
[orbi.git] / src / orbi.cpp
index b05244189b05a5c9535fee342f1cde49eb522d92..a0dab98a27621f29b19689480ea86882c3dd81bf 100644 (file)
@@ -5,6 +5,7 @@
 #include "graphics/Canvas.h"
 #include "graphics/Window.h"
 #include "world/AABB.h"
+#include "world/Character.h"
 #include "world/Entity.h"
 #include "world/Tile.h"
 #include "world/Tileset.h"
@@ -32,7 +33,7 @@ int main(int argc, const char *argv[]) {
 
        Tileset tiles(
                canv.LoadTexture(sdl.GetBasePath() + "../../data/test-tile.png"),
-               Vector<int>(32, 32)
+               Vector<int>(16, 16)
        );
 
        World world(Vector<int>(10, 10));
@@ -48,9 +49,26 @@ int main(int argc, const char *argv[]) {
        world.SetTile(Vector<int>(9, 5), Tile(0));
        world.SetTile(Vector<int>(9, 6), Tile(0));
 
-       Entity e;
-       e.bounds = AABB(Vector<float>(5, 0), Vector<float>(2, 3));
-       Entity &player = world.AddEntity(e);
+       world.SetTile(Vector<int>(3, 8), Tile(0));
+       world.SetTile(Vector<int>(2, 9), Tile(0));
+       world.SetTile(Vector<int>(3, 9), Tile(0));
+
+       Character player;
+       player.bounds = AABB(0, 0, 2, 3);
+       player.vbox = AABB(.1, 0, 1.8, 3);
+       player.hbox = AABB(0, .1, 2, 1.8);
+       player.arm = AABB(.5, 1.4, 1, .5);
+       player.armOrigin = Vector<float>(1.4, 1.65);
+       //player.armAngle = 1;
+       player.Move(Vector<float>(5, 0));
+       world.AddEntity(player);
+
+       Entity mob;
+       mob.bounds = AABB(0, 0, 2, 1.5);
+       mob.vbox = mob.bounds;
+       mob.hbox = mob.bounds;
+       mob.Move(Vector<float>(1, 0));
+       world.AddEntity(mob);
 
        Application app(canv, world, tiles);
        app.Control(player);