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
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?
|
- In-game editing?
|
||||||
- [ ] Enemies
|
- [ ] Enemies
|
||||||
- [ ] "Position delta" pathfinding
|
- [ ] "Position delta" pathfinding
|
||||||
|
- [ ] Profiling
|
||||||
|
- Seems to use a lot of resources doing hardly anything
|
||||||
- [ ] Something to slice a tile map into a navigation mesh
|
- [ ] Something to slice a tile map into a navigation mesh
|
||||||
- Repeatedly?
|
- Repeatedly?
|
||||||
- Navmesh may be super overkill and astar may be sufficient?
|
- Navmesh may be super overkill and astar may be sufficient?
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
use bevy::prelude::*;
|
use bevy::{prelude::*, window::PrimaryWindow};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
assets::AssetLoader,
|
assets::AssetLoader,
|
||||||
movement::{Heading, Mover, Speed, Velocity},
|
movement::{Heading, Mover, Speed, Velocity},
|
||||||
|
statue::Statue,
|
||||||
};
|
};
|
||||||
|
|
||||||
const PLAYER_SPEED: f32 = 100.;
|
const PLAYER_SPEED: f32 = 100.;
|
||||||
|
@ -44,6 +45,7 @@ fn controls(
|
||||||
mut query: Query<(&mut TextureAtlasSprite, &mut Heading, Entity), With<Player>>,
|
mut query: Query<(&mut TextureAtlasSprite, &mut Heading, Entity), With<Player>>,
|
||||||
input: Res<Input<KeyCode>>,
|
input: Res<Input<KeyCode>>,
|
||||||
assets: Res<AssetLoader>,
|
assets: Res<AssetLoader>,
|
||||||
|
q_windows: Query<&Window, With<PrimaryWindow>>,
|
||||||
) {
|
) {
|
||||||
let (mut sprite, mut heading, player_entity) = query.single_mut();
|
let (mut sprite, mut heading, player_entity) = query.single_mut();
|
||||||
**heading = Vec2::ZERO;
|
**heading = Vec2::ZERO;
|
||||||
|
@ -58,6 +60,20 @@ fn controls(
|
||||||
.id();
|
.id();
|
||||||
commands.entity(player_entity).push_children(&[child]);
|
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