You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
775 B
Rust
33 lines
775 B
Rust
use games::*;
|
|
|
|
fn main() {
|
|
App::new()
|
|
.add_plugins((BaseGamePlugin {
|
|
name: "2d game example".into(),
|
|
game_type: GameType::Two,
|
|
..default()
|
|
},))
|
|
.add_systems(Startup, spawn_guy)
|
|
.run();
|
|
}
|
|
|
|
fn spawn_guy(
|
|
mut commands: Commands,
|
|
server: Res<AssetServer>,
|
|
mut meshes: ResMut<Assets<Mesh>>,
|
|
mut materials: ResMut<Assets<ColorMaterial>>,
|
|
) {
|
|
let material = MeshMaterial2d(materials.add(ColorMaterial {
|
|
texture: Some(server.load("flappy/bevy.png")),
|
|
..default()
|
|
}));
|
|
|
|
let mesh = Mesh2d(meshes.add(Rectangle::new(100.0, 100.0)));
|
|
|
|
let name = Name::new("lil guy");
|
|
|
|
let t = Transform::from_xyz(0.0, 0.0, 0.0);
|
|
|
|
commands.spawn((name, material, mesh, t));
|
|
}
|