aboutsummaryrefslogtreecommitdiff
path: root/src/example/AITest.cpp
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-12 21:21:33 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-12 21:21:33 +0100
commit7f895cda48e180630a3920293a4349b19d1905f9 (patch)
tree757ec566d44de76eb5e509aafece4e86aa812856 /src/example/AITest.cpp
parent2eaebb2a79ef71589a0be89cfe419f874fbadd09 (diff)
parentfd403d038b017ec8976023471073329896035e36 (diff)
Merge branch 'master' of https://github.com/lonkaars/crepe into wouter/text-component
Diffstat (limited to 'src/example/AITest.cpp')
-rw-r--r--src/example/AITest.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/example/AITest.cpp b/src/example/AITest.cpp
index f4efc9f..93ba500 100644
--- a/src/example/AITest.cpp
+++ b/src/example/AITest.cpp
@@ -8,7 +8,6 @@
#include <crepe/api/Scene.h>
#include <crepe/api/Script.h>
#include <crepe/api/Sprite.h>
-#include <crepe/api/Texture.h>
#include <crepe/manager/Mediator.h>
#include <crepe/types.h>
@@ -47,14 +46,19 @@ public:
GameObject game_object1 = mgr.new_object("", "", vec2{0, 0}, 0, 1);
GameObject game_object2 = mgr.new_object("", "", vec2{0, 0}, 0, 1);
- Texture img = Texture("asset/texture/test_ap43.png");
- game_object1.add_component<Sprite>(img, Sprite::Data{
- .color = Color::MAGENTA,
- .flip = Sprite::FlipSettings{false, false},
- .sorting_in_layer = 1,
- .order_in_layer = 1,
- .size = {0, 195},
- });
+ Asset img{"asset/texture/test_ap43.png"};
+
+ Sprite & test_sprite = game_object1.add_component<Sprite>(
+ img, Sprite::Data{
+ .color = Color::MAGENTA,
+ .flip = Sprite::FlipSettings{false, false},
+ .sorting_in_layer = 2,
+ .order_in_layer = 2,
+ .size = {0, 100},
+ .angle_offset = 0,
+ .position_offset = {0, 0},
+ });
+
AI & ai = game_object1.add_component<AI>(3000);
// ai.arrive_on();
// ai.flee_on();
@@ -63,7 +67,7 @@ public:
ai.make_oval_path(1000, 500, {0, 500}, 4.7124, false);
game_object1.add_component<Rigidbody>(Rigidbody::Data{
.mass = 0.1f,
- .max_linear_velocity = {40, 40},
+ .max_linear_velocity = 40,
});
game_object1.add_component<BehaviorScript>().set_script<Script1>();