diff options
Diffstat (limited to 'game/prefab')
-rw-r--r-- | game/prefab/CMakeLists.txt | 1 | ||||
-rw-r--r-- | game/prefab/ZapperObject.cpp | 8 | ||||
-rw-r--r-- | game/prefab/ZapperObject.h | 2 | ||||
-rw-r--r-- | game/prefab/ZapperScript.cpp | 20 | ||||
-rw-r--r-- | game/prefab/ZapperScript.h | 17 |
5 files changed, 3 insertions, 45 deletions
diff --git a/game/prefab/CMakeLists.txt b/game/prefab/CMakeLists.txt index 03084e4..5585a32 100644 --- a/game/prefab/CMakeLists.txt +++ b/game/prefab/CMakeLists.txt @@ -2,6 +2,5 @@ target_sources(main PUBLIC PlayerObject.cpp PlayerScript.cpp ZapperObject.cpp - ZapperScript.cpp ) diff --git a/game/prefab/ZapperObject.cpp b/game/prefab/ZapperObject.cpp index b848f18..e63a5f2 100644 --- a/game/prefab/ZapperObject.cpp +++ b/game/prefab/ZapperObject.cpp @@ -1,6 +1,5 @@ #include "ZapperObject.h" #include "Config.h" -#include "ZapperScript.h" using namespace crepe; @@ -67,14 +66,13 @@ ZapperObject::ZapperObject(crepe::GameObject && base) sprite.orb_end, ivec2(62, 42), uvec2(4, 1), animator.orb_start.data ), .glow_start = add_component<Animator>( - sprite.glow_start, ivec2(128, 128), uvec2(4, 4), + sprite.glow_start, ivec2(128, 128), uvec2(16, 1), Animator::Data { .fps = 30, .looping = true, } ), .glow_end = add_component<Animator>( - sprite.glow_end, ivec2(128, 128), uvec2(4, 4), animator.glow_start.data + sprite.glow_end, ivec2(128, 128), uvec2(16, 1), animator.glow_start.data ), - }, - controller(add_component<BehaviorScript>().set_script<ZapperScript>(*this)) {} + } {} diff --git a/game/prefab/ZapperObject.h b/game/prefab/ZapperObject.h index 151e368..cc2d37c 100644 --- a/game/prefab/ZapperObject.h +++ b/game/prefab/ZapperObject.h @@ -1,7 +1,6 @@ #pragma once #include <crepe/api/Animator.h> -#include <crepe/api/BehaviorScript.h> #include <crepe/api/BoxCollider.h> #include <crepe/api/GameObject.h> #include <crepe/api/Rigidbody.h> @@ -29,7 +28,6 @@ public: // crepe::Rigidbody & body; // crepe::BoxCollider & collider; - crepe::BehaviorScript & controller; private: static constexpr int SCALE = 60; diff --git a/game/prefab/ZapperScript.cpp b/game/prefab/ZapperScript.cpp deleted file mode 100644 index 01eb7aa..0000000 --- a/game/prefab/ZapperScript.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include <cassert> -#include <crepe/api/Rigidbody.h> - -#include "ZapperScript.h" - -using namespace crepe; -using namespace std; - -ZapperScript::ZapperScript(const ZapperObject & zapper) : zapper(zapper) {} - -void ZapperScript::init() { - zapper.sprite.beam.mask = { - .w = 350, - .h = 117, - .x = 0, - .y = 0, - }; -} - -void ZapperScript::frame_update(duration_t delta_time) { zapper.sprite.beam.mask.x += 4; } diff --git a/game/prefab/ZapperScript.h b/game/prefab/ZapperScript.h deleted file mode 100644 index b090c8d..0000000 --- a/game/prefab/ZapperScript.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include <crepe/api/Script.h> - -#include "ZapperObject.h" - -class ZapperScript : public crepe::Script { -public: - ZapperScript(const ZapperObject & zapper); - -protected: - void init(); - void frame_update(crepe::duration_t delta_time); - -protected: - ZapperObject zapper; -}; |