Updated aliases and added basic movement
parent
a5e6c99c47
commit
e29be70a93
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
|
@ -75,7 +75,8 @@
|
||||||
pkgs.udev
|
pkgs.udev
|
||||||
pkgs.vulkan-loader
|
pkgs.vulkan-loader
|
||||||
]}"
|
]}"
|
||||||
alias run="nixVulkanIntel cargo run"
|
alias runIntel="nixVulkanIntel cargo run"
|
||||||
|
alias runMommyIntel="nixVulkanIntel cargo mommy run"
|
||||||
onefetch
|
onefetch
|
||||||
echo "Welcome to nix-hell uh nix-shell!"
|
echo "Welcome to nix-hell uh nix-shell!"
|
||||||
'';
|
'';
|
||||||
|
|
53
src/main.rs
53
src/main.rs
|
@ -2,6 +2,57 @@ use bevy::prelude::*;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
App::new()
|
App::new()
|
||||||
.add_plugins(DefaultPlugins)
|
.add_plugins(
|
||||||
|
DefaultPlugins
|
||||||
|
.set(ImagePlugin::default_nearest())
|
||||||
|
.set(WindowPlugin {
|
||||||
|
primary_window: Some(Window {
|
||||||
|
title: "HertogGame".into(),
|
||||||
|
resolution: (500.0, 500.0).into(),
|
||||||
|
resizable: false,
|
||||||
|
..default()
|
||||||
|
}),
|
||||||
|
..default()
|
||||||
|
})
|
||||||
|
.build(),
|
||||||
|
)
|
||||||
|
.add_systems(Startup, setup)
|
||||||
|
.add_systems(Update, character_movement)
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
|
||||||
|
commands.spawn(Camera2dBundle::default());
|
||||||
|
|
||||||
|
let texture = asset_server.load("blobcat_hertog.png");
|
||||||
|
|
||||||
|
commands.spawn(SpriteBundle {
|
||||||
|
sprite: Sprite {
|
||||||
|
custom_size: Some(Vec2::new(100.0, 100.0)),
|
||||||
|
..default()
|
||||||
|
},
|
||||||
|
texture,
|
||||||
|
..default()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
fn character_movement(
|
||||||
|
mut characters: Query<(&mut Transform, &Sprite)>,
|
||||||
|
input: Res<Input<KeyCode>>,
|
||||||
|
time: Res<Time>,
|
||||||
|
) {
|
||||||
|
for (mut transform, _) in &mut characters {
|
||||||
|
if input.pressed(KeyCode::W) {
|
||||||
|
transform.translation.y += 100.0 * time.delta_seconds();
|
||||||
|
}
|
||||||
|
if input.pressed(KeyCode::S) {
|
||||||
|
transform.translation.y -= 100.0 * time.delta_seconds();
|
||||||
|
}
|
||||||
|
if input.pressed(KeyCode::D) {
|
||||||
|
transform.translation.x += 100.0 * time.delta_seconds();
|
||||||
|
}
|
||||||
|
if input.pressed(KeyCode::A) {
|
||||||
|
transform.translation.x -= 100.0 * time.delta_seconds();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue