Use some constants
This commit is contained in:
parent
aa7e888d9e
commit
6a2c77404b
@ -9,6 +9,10 @@ mod prelude {
|
||||
pub use crate::resources::*;
|
||||
pub use crate::systems::*;
|
||||
pub use bevy::prelude::*;
|
||||
|
||||
pub const SCREEN_WIDTH: f32 = 80.0;
|
||||
pub const SCREEN_HEIGHT: f32 = 50.0;
|
||||
pub const TILE_SIZE: f32 = 64.0;
|
||||
}
|
||||
|
||||
use prelude::*;
|
||||
|
@ -11,9 +11,9 @@ pub fn setup(
|
||||
|
||||
// Map
|
||||
let grass_material = materials.add(asset_server.load("grass.png").into());
|
||||
let tile_size = Vec2::new(64.0, 64.0);
|
||||
let tile_size = Vec2::new(TILE_SIZE, TILE_SIZE);
|
||||
let sprite = Sprite::new(tile_size);
|
||||
let map_size = Vec2::new(80.0, 50.0);
|
||||
let map_size = Vec2::new(SCREEN_HEIGHT, SCREEN_HEIGHT);
|
||||
let half_x = (map_size.x / 2.0) as i32;
|
||||
let half_y = (map_size.y / 2.0) as i32;
|
||||
|
||||
@ -45,7 +45,7 @@ pub fn add_player(
|
||||
.insert(Name("Player 1".to_string()))
|
||||
.insert_bundle(SpriteBundle {
|
||||
material: player_material,
|
||||
sprite: Sprite::new(Vec2::new(64.0, 64.0)),
|
||||
sprite: Sprite::new(Vec2::new(TILE_SIZE, TILE_SIZE)),
|
||||
transform: Transform::from_translation(Vec3::new(0.0, 0.0, 1.0)),
|
||||
..Default::default()
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user