a8e2e61
M Binary, M Against the Current, M Cavings I, M Green Race, M Lygerastia, M Try Again, M Wonderland, A Sunny Night - ddnet-mapschecking for ld.mold... ld.mold
checking version of ld.mold... v. ?.??, bad
checking for gnumake... no
checking for gmake... gmake
checking version of gmake... 4.4.1, ok
checking for gnumsgfmt... no
checking for gmsgfmt... gmsgfmt
checking version of gmsgfmt... 0.21.1, ok
checking for makeinfo... /dev/null
checking version of /dev/null... v. ?.??, bad
pub fn player_camera(
mut query_player: Query<(&mut AimTarget, &Transform), (With<Player>, Without<MainCamera>)>,
mut query_camera: Query<&mut Transform, With<MainCamera>>,
) {
let mut camera_transform = query_camera.single_mut();
let (mut aim_target, player_transform) = query_player.single_mut();
let old = camera_transform.translation;
camera_transform.translation = Vec3::new(
player_transform.translation.x,
player_transform.translation.y,
camera_transform.translation.z,
);
// Keep the aim same when camera is moving
let diff = camera_transform.translation - old;
if diff.length() > 0.0 {
if let Some(t) = aim_target.0.as_mut() {
*t += diff.xy();
}
}
}
.add_startup_system(general_setup)
.add_startup_system(player::add_player)
.add_systems((player::player_input, player::player_mouse).before(physics::move_system))
.add_system(physics::move_system)
.add_system(misc::aim_target_system.after(physics::move_system))
.add_system(player::player_camera.after(misc::aim_target_system))
def center_around_tee(tee)
wc = WINDOW_WIDTH / 2
hc = WINDOW_HEIGHT / 2
x = -tee.x + wc
y = -tee.y + hc
Entitiy.new(x:, y:)
end