Click to spawn statues to learn mouse positioning stuff, prep for UI work in order to implement networking
This commit is contained in:
parent
df3c3e989f
commit
458bd994d6
3 changed files with 19 additions and 1 deletions
BIN
assets/font/iosevkalyteweb-regular.subset.woff2
Normal file
BIN
assets/font/iosevkalyteweb-regular.subset.woff2
Normal file
Binary file not shown.
|
@ -29,6 +29,8 @@ the heavy-lifting for me _plus_ it's a fun excuse to write more Rust.
|
|||
- In-game editing?
|
||||
- [ ] Enemies
|
||||
- [ ] "Position delta" pathfinding
|
||||
- [ ] Profiling
|
||||
- Seems to use a lot of resources doing hardly anything
|
||||
- [ ] Something to slice a tile map into a navigation mesh
|
||||
- Repeatedly?
|
||||
- Navmesh may be super overkill and astar may be sufficient?
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
use bevy::prelude::*;
|
||||
use bevy::{prelude::*, window::PrimaryWindow};
|
||||
|
||||
use crate::{
|
||||
assets::AssetLoader,
|
||||
movement::{Heading, Mover, Speed, Velocity},
|
||||
statue::Statue,
|
||||
};
|
||||
|
||||
const PLAYER_SPEED: f32 = 100.;
|
||||
|
@ -44,6 +45,7 @@ fn controls(
|
|||
mut query: Query<(&mut TextureAtlasSprite, &mut Heading, Entity), With<Player>>,
|
||||
input: Res<Input<KeyCode>>,
|
||||
assets: Res<AssetLoader>,
|
||||
q_windows: Query<&Window, With<PrimaryWindow>>,
|
||||
) {
|
||||
let (mut sprite, mut heading, player_entity) = query.single_mut();
|
||||
**heading = Vec2::ZERO;
|
||||
|
@ -58,6 +60,20 @@ fn controls(
|
|||
.id();
|
||||
commands.entity(player_entity).push_children(&[child]);
|
||||
}
|
||||
KeyCode::Key1 => {
|
||||
if let Some(position) = q_windows.single().cursor_position() {
|
||||
let spos = position.extend(0.);
|
||||
commands.spawn((
|
||||
Statue,
|
||||
SpriteSheetBundle {
|
||||
texture_atlas: assets.images.statue.clone(),
|
||||
sprite: TextureAtlasSprite::new(0),
|
||||
transform: Transform::from_translation(spos),
|
||||
..Default::default()
|
||||
},
|
||||
));
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue