-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy path2d.rs
37 lines (34 loc) · 829 Bytes
/
2d.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use bevy::prelude::*;
use bevy_fly_camera::{FlyCamera2d, FlyCameraPlugin};
fn init(
mut commands: Commands,
asset_server: Res<AssetServer>,
mut materials: ResMut<Assets<ColorMaterial>>,
) {
commands
.spawn(Camera2dBundle::default())
.insert(FlyCamera2d::default());
const AMOUNT: i32 = 6;
const SPACING: f32 = 300.0;
for x in -(AMOUNT / 2)..(AMOUNT / 2) {
for y in -(AMOUNT / 2)..(AMOUNT / 2) {
commands.spawn(SpriteBundle {
texture: asset_server.load("icon.png"),
transform: Transform::from_xyz(
x as f32 * SPACING,
y as f32 * SPACING,
0.0,
),
..Default::default()
});
}
}
}
fn main() {
App::new()
.insert_resource(Msaa::Sample4)
.add_plugins(DefaultPlugins)
.add_startup_system(init)
.add_plugin(FlyCameraPlugin)
.run();
}