Game runs again, but not playable
This commit is contained in:
parent
d431756ce1
commit
3d5df31da7
10
Cargo.lock
generated
10
Cargo.lock
generated
|
@ -294,6 +294,7 @@ version = "0.14.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8e938630e9f472b1899c78ef84aa907081b23bad8333140e2295c620485b6ee7"
|
checksum = "8e938630e9f472b1899c78ef84aa907081b23bad8333140e2295c620485b6ee7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"bevy_dylib",
|
||||||
"bevy_internal",
|
"bevy_internal",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -469,6 +470,15 @@ dependencies = [
|
||||||
"const-fnv1a-hash",
|
"const-fnv1a-hash",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bevy_dylib"
|
||||||
|
version = "0.14.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f8494bf550eb30f570da1563217bcea25530cf29b35d35887ca6c2d76a411d00"
|
||||||
|
dependencies = [
|
||||||
|
"bevy_internal",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bevy_ecs"
|
name = "bevy_ecs"
|
||||||
version = "0.14.0"
|
version = "0.14.0"
|
||||||
|
|
|
@ -23,7 +23,7 @@ bevy = { version = "0.14.0", default-features = false, features = [
|
||||||
"wav", # sound files
|
"wav", # sound files
|
||||||
|
|
||||||
# TODO: would be nice to get this working while developing
|
# TODO: would be nice to get this working while developing
|
||||||
# "dynamic_linking",
|
"dynamic_linking",
|
||||||
|
|
||||||
# NOTE: Features we may want at some point.
|
# NOTE: Features we may want at some point.
|
||||||
# "vorbis", # music -- maybe mp3?
|
# "vorbis", # music -- maybe mp3?
|
||||||
|
|
|
@ -2,7 +2,7 @@ use bevy::prelude::*;
|
||||||
use bevy::render::camera::Camera;
|
use bevy::render::camera::Camera;
|
||||||
|
|
||||||
pub fn startup(mut commands: Commands) {
|
pub fn startup(mut commands: Commands) {
|
||||||
let mut bundle = (Camera2dBundle::default(), IsDefaultUiCamera);
|
let bundle = (Camera2dBundle::default(), IsDefaultUiCamera);
|
||||||
// bundle.0.projection.scale = 1;
|
// bundle.0.projection.scale = 1;
|
||||||
commands.spawn(bundle);
|
commands.spawn(bundle);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,11 +35,6 @@ struct InGameSet;
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut app = App::new();
|
let mut app = App::new();
|
||||||
|
|
||||||
app.init_resource::<assets::AssetLoader>();
|
|
||||||
|
|
||||||
app.insert_state(View::default());
|
|
||||||
app.insert_state(Game::default());
|
|
||||||
|
|
||||||
app.add_plugins((
|
app.add_plugins((
|
||||||
DefaultPlugins
|
DefaultPlugins
|
||||||
.set(WindowPlugin {
|
.set(WindowPlugin {
|
||||||
|
@ -59,6 +54,9 @@ fn main() {
|
||||||
.set(ImagePlugin::default_nearest()),
|
.set(ImagePlugin::default_nearest()),
|
||||||
FrameTimeDiagnosticsPlugin,
|
FrameTimeDiagnosticsPlugin,
|
||||||
))
|
))
|
||||||
|
.init_resource::<assets::AssetLoader>()
|
||||||
|
.insert_state(View::default())
|
||||||
|
.insert_state(Game::default())
|
||||||
.add_systems(OnEnter(View::MainMenu), main_menu::startup)
|
.add_systems(OnEnter(View::MainMenu), main_menu::startup)
|
||||||
.add_systems(OnExit(View::MainMenu), main_menu::exit)
|
.add_systems(OnExit(View::MainMenu), main_menu::exit)
|
||||||
.add_systems(OnEnter(View::InGame), (player::startup, statue::startup))
|
.add_systems(OnEnter(View::InGame), (player::startup, statue::startup))
|
||||||
|
|
|
@ -101,13 +101,15 @@ pub fn controls(
|
||||||
mut next_state: ResMut<NextState<crate::View>>,
|
mut next_state: ResMut<NextState<crate::View>>,
|
||||||
mut crosshair_q: Query<&mut Transform, With<Crosshair>>,
|
mut crosshair_q: Query<&mut Transform, With<Crosshair>>,
|
||||||
) {
|
) {
|
||||||
let (mut sprite, mut texture, mut heading, player_entity) = player_q.single_mut();
|
if let Ok((mut sprite, mut texture, mut heading, player_entity)) = player_q.get_single_mut() {
|
||||||
let (camera, camera_transform) = cam_q.single();
|
let (camera, camera_transform) = cam_q.single();
|
||||||
|
|
||||||
let mouse_world_position = win_q
|
let mouse_world_position = win_q
|
||||||
.single()
|
.single()
|
||||||
.cursor_position()
|
.cursor_position()
|
||||||
.and_then(|cursor| camera.viewport_to_world(&GlobalTransform::from_xyz(0., 0., 0.), cursor))
|
.and_then(|cursor| {
|
||||||
|
camera.viewport_to_world(&GlobalTransform::from_xyz(0., 0., 0.), cursor)
|
||||||
|
})
|
||||||
.map(|ray| ray.origin.truncate());
|
.map(|ray| ray.origin.truncate());
|
||||||
|
|
||||||
if let Some(pos) = mouse_world_position {
|
if let Some(pos) = mouse_world_position {
|
||||||
|
@ -187,6 +189,7 @@ pub fn controls(
|
||||||
texture.index = 2;
|
texture.index = 2;
|
||||||
sprite.flip_x = heading.x > 0.;
|
sprite.flip_x = heading.x > 0.;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn sprite_select(
|
pub fn sprite_select(
|
||||||
|
|
Loading…
Reference in a new issue