aboutsummaryrefslogtreecommitdiff
path: root/game/prefab/ZapperObject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'game/prefab/ZapperObject.cpp')
-rw-r--r--game/prefab/ZapperObject.cpp11
1 files changed, 11 insertions, 0 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;
}