aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--game/prefab/ZapperObject.cpp11
-rw-r--r--game/prefab/ZapperObject.h4
2 files changed, 13 insertions, 2 deletions
diff --git a/game/prefab/ZapperObject.cpp b/game/prefab/ZapperObject.cpp
index fcc6467..f70415c 100644
--- a/game/prefab/ZapperObject.cpp
+++ b/game/prefab/ZapperObject.cpp
@@ -73,6 +73,15 @@ ZapperObject::ZapperObject(crepe::GameObject && base)
.glow_end = add_component<Animator>(
sprite.glow_end, ivec2(128, 128), uvec2(16, 1), animator.glow_start.data
),
+ },
+ body {
+ add_component<Rigidbody>(Rigidbody::Data {
+ .body_type = Rigidbody::BodyType::KINEMATIC,
+ .kinematic_collision = false,
+ })
+ },
+ collider {
+ add_component<BoxCollider>(vec2(0, 0))
} {
this->place(this->transform.position, 0, 300);
}
@@ -89,5 +98,7 @@ void ZapperObject::place(const crepe::vec2 & position, float rotation, float len
this->sprite.glow_end.data.position_offset = -offset;
this->sprite.beam.data.size.x = length;
+
+ this->collider.dimensions = offset.rotate(rotation) * 2 + vec2(30, 30) * SCALE;
}
diff --git a/game/prefab/ZapperObject.h b/game/prefab/ZapperObject.h
index b4bb942..c43af67 100644
--- a/game/prefab/ZapperObject.h
+++ b/game/prefab/ZapperObject.h
@@ -26,8 +26,8 @@ public:
crepe::Animator & glow_end;
} animator;
- // crepe::Rigidbody & body;
- // crepe::BoxCollider & collider;
+ crepe::Rigidbody & body;
+ crepe::BoxCollider & collider;
private:
static constexpr float SCALE = 0.8;