diff options
author | Jaro <59013720+JaroWMR@users.noreply.github.com> | 2024-12-12 18:47:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-12 18:47:54 +0100 |
commit | fd403d038b017ec8976023471073329896035e36 (patch) | |
tree | fcf4af55aa56b2de19e87e5246888e1af9f4f527 /src/example/AITest.cpp | |
parent | 05a33d4793520fa84a93bc79882ef29d39cd08e5 (diff) | |
parent | ab1423f48d82ba9b0619ec107639a80773edbfc2 (diff) |
Merge pull request #64 from lonkaars/jaro/physics-system-improvement
Jaro/physics system improvement
Diffstat (limited to 'src/example/AITest.cpp')
-rw-r--r-- | src/example/AITest.cpp | 24 |
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>(); |