Compare commits
2 Commits
ec3185f386
...
make_basic
| Author | SHA1 | Date | |
|---|---|---|---|
| d6b2a93eac | |||
| ef257f43e6 |
29
src/main.rs
29
src/main.rs
@@ -1,8 +1,20 @@
|
|||||||
use bevy::{prelude::*, window::WindowResolution};
|
use bevy::{prelude::*, window::WindowResolution};
|
||||||
use bevy_ecs_tilemap::prelude::*;
|
use bevy_ecs_tilemap::prelude::*;
|
||||||
|
|
||||||
const MAP_SIZE: TilemapSize = TilemapSize { x: 50, y: 25 };
|
const TILEMAP_WIDTH: u32 = 50;
|
||||||
const TILE_SIZE: TilemapTileSize = TilemapTileSize { x: 25.0, y: 25.0 };
|
const TILEMAP_HEIGHT: u32 = 25;
|
||||||
|
|
||||||
|
const TILE_WIDTH: f32 = 25.0;
|
||||||
|
const TILE_HEIGHT: f32 = 25.0;
|
||||||
|
|
||||||
|
const MAP_SIZE: TilemapSize = TilemapSize {
|
||||||
|
x: TILEMAP_WIDTH,
|
||||||
|
y: TILEMAP_HEIGHT,
|
||||||
|
};
|
||||||
|
const TILE_SIZE: TilemapTileSize = TilemapTileSize {
|
||||||
|
x: TILE_WIDTH,
|
||||||
|
y: TILE_HEIGHT,
|
||||||
|
};
|
||||||
|
|
||||||
fn startup(mut commands: Commands, asset_server: Res<AssetServer>) {
|
fn startup(mut commands: Commands, asset_server: Res<AssetServer>) {
|
||||||
commands.spawn(Camera2d);
|
commands.spawn(Camera2d);
|
||||||
@@ -30,8 +42,8 @@ fn startup(mut commands: Commands, asset_server: Res<AssetServer>) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for x in 0..5 {
|
for x in 0..3 {
|
||||||
for y in 10..15 {
|
for y in 11..14 {
|
||||||
if x < MAP_SIZE.x && y < MAP_SIZE.y {
|
if x < MAP_SIZE.x && y < MAP_SIZE.y {
|
||||||
let tile_pos = TilePos { x, y };
|
let tile_pos = TilePos { x, y };
|
||||||
let tile_entity = commands
|
let tile_entity = commands
|
||||||
@@ -46,8 +58,8 @@ fn startup(mut commands: Commands, asset_server: Res<AssetServer>) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for x in 45..50 {
|
for x in 47..50 {
|
||||||
for y in 10..15 {
|
for y in 11..14 {
|
||||||
if x < MAP_SIZE.x && y < MAP_SIZE.y {
|
if x < MAP_SIZE.x && y < MAP_SIZE.y {
|
||||||
let tile_pos = TilePos { x, y };
|
let tile_pos = TilePos { x, y };
|
||||||
let tile_entity = commands
|
let tile_entity = commands
|
||||||
@@ -94,7 +106,10 @@ fn main() {
|
|||||||
.set(WindowPlugin {
|
.set(WindowPlugin {
|
||||||
primary_window: Some(Window {
|
primary_window: Some(Window {
|
||||||
title: String::from("War in Tunnels"),
|
title: String::from("War in Tunnels"),
|
||||||
resolution: WindowResolution::new(1250, 625)
|
resolution: WindowResolution::new(
|
||||||
|
TILEMAP_WIDTH * TILE_WIDTH as u32,
|
||||||
|
TILEMAP_HEIGHT * TILE_HEIGHT as u32,
|
||||||
|
)
|
||||||
.with_scale_factor_override(1.0),
|
.with_scale_factor_override(1.0),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user