Compare commits

..

No commits in common. "32f6a822a2cb620c1ff52136a8d69ab877894908" and "3fe46fd11622a1d93ff2f6a671d444db6814eeff" have entirely different histories.

4 changed files with 1 additions and 33 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 381 B

View File

@ -15,8 +15,7 @@ use prelude::*;
fn main() {
App::build()
.insert_resource(ClearColor(Color::rgb(0.0, 0.0, 0.0)))
.add_plugins(DefaultPlugins)
.add_startup_system(setup.system())
.add_plugin(PlayerPlugin)
.run();
}

View File

@ -1,36 +1,5 @@
use crate::prelude::*;
pub fn setup(
mut commands: Commands,
asset_server: Res<AssetServer>,
mut materials: ResMut<Assets<ColorMaterial>>,
) {
// Camera
commands.spawn_bundle(OrthographicCameraBundle::new_2d());
// Map
let grass_material = materials.add(asset_server.load("grass.png").into());
let tile_size = Vec2::new(32.0, 32.0);
let sprite = Sprite::new(tile_size);
let map_size = Vec2::new(80.0, 50.0);
let half_x = (map_size.x / 2.0) as i32;
let half_y = (map_size.y / 2.0) as i32;
for y in -half_y..half_y {
for x in -half_x..half_x {
let position = Vec2::new(x as f32, y as f32);
let translation = (position * tile_size).extend(0.0);
commands.spawn_bundle(SpriteBundle {
material: grass_material.clone(),
sprite: sprite.clone(),
transform: Transform::from_translation(translation),
..Default::default()
});
}
}
}
pub fn add_player(mut commands: Commands) {
commands
.spawn()