generated from 2ndbeam/bevy-template
feat: Barely working tilemap system
- Added tilemap bundle - Added HALVED_METERS_PER_PIXEL constant
This commit is contained in:
parent
ffdb5d94a8
commit
b59cec172d
8 changed files with 109 additions and 18 deletions
|
|
@ -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.),
|
||||
)),
|
||||
)),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue