Spawn areas with correct size, remove printlns, and reformat.
This commit is contained in:
parent
f16333d258
commit
02eff61016
14
src/map.rs
14
src/map.rs
|
@ -210,9 +210,11 @@ fn spawn_colliders(
|
|||
) {
|
||||
for (map_entity, map, spawn_colliders, spawn_collider_per_tile) in maps.iter() {
|
||||
if **spawn_colliders {
|
||||
commands.entity(map_entity).remove::<SpawnColliders>();
|
||||
commands.entity(map_entity).remove::<SpawnColliderPerTile>();
|
||||
commands.entity(map_entity).insert_bundle(RigidBodyBundle {
|
||||
commands
|
||||
.entity(map_entity)
|
||||
.remove::<SpawnColliders>()
|
||||
.remove::<SpawnColliderPerTile>()
|
||||
.insert_bundle(RigidBodyBundle {
|
||||
body_type: RigidBodyType::Static,
|
||||
..Default::default()
|
||||
});
|
||||
|
@ -335,10 +337,8 @@ fn spawn_colliders(
|
|||
}
|
||||
}
|
||||
for room in &map.rooms {
|
||||
let shape = ColliderShape::cuboid(
|
||||
(room.width() / 2) as f32 + 0.5,
|
||||
(room.height() / 2) as f32 + 0.5,
|
||||
);
|
||||
let shape =
|
||||
ColliderShape::cuboid((room.width() / 2) as f32, (room.height() / 2) as f32);
|
||||
let position = Vec2::new(room.center().x() + 0.5, room.center().y() + 0.5).into();
|
||||
let id = commands
|
||||
.spawn_bundle(ColliderBundle {
|
||||
|
|
Loading…
Reference in New Issue
Block a user