diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2025-01-07 10:05:58 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2025-01-07 10:05:58 +0100 |
commit | f8496d3d48beeb6e0c5ef8dc82e16d281c94148e (patch) | |
tree | c6ad1a197d878bfb9dddd6f549adf439225de29b /game/prefab/ZapperObject.cpp | |
parent | 743cdd5b2fe175605352c337396c3d70dac66247 (diff) |
add collider to zapper
Diffstat (limited to 'game/prefab/ZapperObject.cpp')
-rw-r--r-- | game/prefab/ZapperObject.cpp | 11 |
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; } |