feat: Barely working tilemap system

- Added tilemap bundle
- Added HALVED_METERS_PER_PIXEL constant
This commit is contained in:
Alexey 2026-03-23 14:06:36 +03:00
commit b59cec172d
8 changed files with 109 additions and 18 deletions

View file

@ -2,13 +2,11 @@ use bevy::prelude::*;
use bevy_rapier2d::prelude::*;
use crate::{
GameState,
PIXELS_PER_METER,
inventory::{
GameState, HALVED_PIXELS_PER_METER, PIXELS_PER_METER, inventory::{
ActiveInventory,
Inventory,
item::Item,
},
}
};
use super::*;
@ -47,7 +45,7 @@ pub fn container_bundle(
let image = asset_server.load(CRATE_CLOSED_ASSET);
(
Container,
Transform::from_xyz(position.x, position.y - PIXELS_PER_METER * 0.5, 0.),
Transform::from_xyz(position.x, position.y - HALVED_PIXELS_PER_METER, 0.),
Sprite::from_image(image),
Inventory::new(inventory_size),
Observer::new(on_container_interact),
@ -56,7 +54,7 @@ pub fn container_bundle(
Spawn((
Collider::cuboid(PIXELS_PER_METER, PIXELS_PER_METER),
Sensor,
Transform::from_xyz(0., PIXELS_PER_METER * 0.5, 0.),
Transform::from_xyz(0., HALVED_PIXELS_PER_METER, 0.),
)),
)),
)