From 9625b751757b8828b0edb0b7543c7cadfd25c119 Mon Sep 17 00:00:00 2001 From: WBoerenkamps Date: Wed, 8 Jan 2025 12:38:24 +0100 Subject: enemy sequence working --- game/enemy/EnemySubScene.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'game/enemy/EnemySubScene.cpp') diff --git a/game/enemy/EnemySubScene.cpp b/game/enemy/EnemySubScene.cpp index 43f9b33..66aedd5 100644 --- a/game/enemy/EnemySubScene.cpp +++ b/game/enemy/EnemySubScene.cpp @@ -1,7 +1,6 @@ #include -#include "EnemySubScene.h" -#include "EnemyScript.h" + #include #include #include @@ -10,21 +9,24 @@ #include #include #include - #include + #include "../Config.h" +#include "EnemySubScene.h" +#include "EnemyScript.h" +#include "EnemyConfig.h" using namespace crepe; using namespace std; +//#TODO add sound int EnemySubScene::create(Scene & scn){ vec2 size = {20, 20}; static int enemy_counter = 0; string unique_name = "enemy_" + to_string(enemy_counter++); - GameObject enemy = scn.new_object(unique_name.c_str(),"enemy",vec2{0,-650},0,1); + GameObject enemy = scn.new_object(unique_name.c_str(),"enemy",ENEMY_POOL_LOCATION,0,1); enemy.add_component(Rigidbody::Data { .gravity_scale = 0, - .body_type = Rigidbody::BodyType::DYNAMIC, .max_linear_velocity = 400, .collision_layers = {COLL_LAY_BOT_TOP,COLL_LAY_PLAYER_BULLET}, @@ -37,7 +39,7 @@ int EnemySubScene::create(Scene & scn){ enemy_body_asset, Sprite::Data { .flip = {true,false}, - .sorting_in_layer = SORT_IN_LAY_PLAYER, + .sorting_in_layer = SORT_IN_LAY_WORKERS_FRONT, .order_in_layer = 0, .size = vec2(0, 50), } @@ -59,7 +61,7 @@ int EnemySubScene::create(Scene & scn){ enemy_head_asset, Sprite::Data { .flip = {true,false}, - .sorting_in_layer = SORT_IN_LAY_PLAYER, + .sorting_in_layer = SORT_IN_LAY_WORKERS_FRONT, .order_in_layer = 1, .size = vec2(0, 50), .position_offset = vec2(0, -20), @@ -78,7 +80,7 @@ int EnemySubScene::create(Scene & scn){ enemy_jetpack_asset, Sprite::Data { .flip = {true,false}, - .sorting_in_layer = SORT_IN_LAY_PLAYER, + .sorting_in_layer = SORT_IN_LAY_WORKERS_FRONT, .order_in_layer = 2, .size = vec2(0, 60), .position_offset = vec2(20, 0), -- cgit v1.2.3