From a4c65ca6a69987349f703e51beed47a219d3d92d Mon Sep 17 00:00:00 2001 From: JAROWMR Date: Wed, 11 Dec 2024 21:32:05 +0100 Subject: timing fix --- src/example/AITest.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src/example') 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 #include #include -#include #include #include @@ -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(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( + 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(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::Data{ .mass = 0.1f, - .max_linear_velocity = {40, 40}, + .max_linear_velocity = 40, }); game_object1.add_component().set_script(); -- cgit v1.2.3