feat: Add savegame loading (#37)
This commit is contained in:
@@ -98,7 +98,7 @@ fn load_savegame(
|
||||
mut phase: ResMut<CurrentPhase>,
|
||||
mut tracker: ResMut<SessionTracker>,
|
||||
mut settings: ResMut<TimerSettings>,
|
||||
mut pom_query: Query<&mut GridPosition, With<Pom>>,
|
||||
mut pom_query: Query<(&mut GridPosition, &mut Transform), With<Pom>>,
|
||||
) {
|
||||
for _ in messages.read() {
|
||||
if let Ok(mut file) = File::open(&save_path.0) {
|
||||
@@ -114,8 +114,15 @@ fn load_savegame(
|
||||
*tracker = save_data.session_tracker;
|
||||
*settings = save_data.timer_settings;
|
||||
|
||||
if let Ok(mut pom_pos) = pom_query.single_mut() {
|
||||
if let Ok((mut pom_pos, mut pom_transform)) = pom_query.single_mut() {
|
||||
*pom_pos = save_data.pom_position;
|
||||
pom_transform.translation = grid_to_world_coords(
|
||||
save_data.pom_position.x,
|
||||
save_data.pom_position.y,
|
||||
Some(1.0),
|
||||
save_data.grid_width,
|
||||
save_data.grid_height,
|
||||
)
|
||||
}
|
||||
|
||||
for x in 0..save_data.grid_width {
|
||||
|
||||
Reference in New Issue
Block a user