diff options
author | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2025-01-06 10:46:11 +0100 |
---|---|---|
committer | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2025-01-06 10:46:11 +0100 |
commit | 36942c357663a033582a1dfb39af0d3ab15afd0c (patch) | |
tree | 4edf5b5dcdd5fe6ec5011c89583324d291a00850 /game/enemy/EnemySubScene.cpp | |
parent | cf6ca6be5a9deac4de921f50d0aedf6a6156e0f4 (diff) |
start of enemypool and creation
Diffstat (limited to 'game/enemy/EnemySubScene.cpp')
-rw-r--r-- | game/enemy/EnemySubScene.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/game/enemy/EnemySubScene.cpp b/game/enemy/EnemySubScene.cpp new file mode 100644 index 0000000..4187411 --- /dev/null +++ b/game/enemy/EnemySubScene.cpp @@ -0,0 +1,29 @@ +#include <string> + +#include "EnemySubScene.h" +#include <crepe/api/GameObject.h> +#include <crepe/api/Scene.h> +#include <crepe/api/BoxCollider.h> +#include <crepe/api/Rigidbody.h> +#include <crepe/api/BehaviorScript.h> +#include <crepe/api/Sprite.h> +using namespace crepe; +using namespace std; +int EnemySubScene::create(Scene & scn){ + vec2 size = {20, 20}; + + static int coin_counter = 0; + string unique_name = "enemy_" + to_string(coin_counter++); + GameObject enemy = scn.new_object(unique_name.c_str(),"enemy",vec2{650,0},0,1); + enemy.add_component<Rigidbody>(Rigidbody::Data{ + .body_type = Rigidbody::BodyType::DYNAMIC, + }); + crepe::OptionalRef<Sprite> enemy_sprite = enemy.add_component<Sprite>(Asset{"asset/coin/coin1_TVOS.png"}, Sprite::Data{ + .sorting_in_layer = 100, + .order_in_layer = 100, + .size = vec2(0, 50), + }); + enemy.add_component<> + + return coin_counter; +} |