OQCI44VL3IROGBJ52MUI3AICPKEPAJVFL45PGQNNQRK4TKIK7HAAC
XRQLBHSFE2FE2UHD4LUTJ2XOTHGVFXKFUKIPDRFL5ZGVYVUJAJUAC
HYJ4HJQVLLDTE6JYKEYQK2LBWREOQUATESGB3QP7WDJB3IMVS6OAC
DBHCCY3W2DG4WYMXBZ2UCNYVGZ5PS5UUUNWCXVYJ4TMXQDIZT6GAC
7FTW5AQKOO4W5AIHYZSAKLQR6LGVTXH7SKMSTA4ER4C4HP54VE4QC
NT6M5NVCET62C54HC6RHQRH2RJUGD4LYCYNSIKJFKCHBN7F33UQQC
5EIYEUF3S5ETMMVECT7GGEEW6O45AJHAA7HS2EWK5II2IYYD7JGAC
5Y32O2B2GTH2UHFA3NO4ZY673XNHT3W4DQADFMK4LMKLSXMZKHGQC
#[derive(Component)]
struct DashState(bool);
fn handle_dashing(mut query: Query<(&mut DashState, &ActionState<PlayerAction>)>) {
for (mut dash_state, action_state) in query.iter_mut() {
// handle hold dash
if action_state.just_pressed(&PlayerAction::HoldDash) {
dash_state.0 = true;
} else if action_state.just_released(&PlayerAction::HoldDash) {
dash_state.0 = false;
}
// Handle toggle dash
if action_state.just_pressed(&PlayerAction::ToggleDash) {
dash_state.0 = !dash_state.0;
}
}
}
transform.translation += dad.xy().extend(0.0) * SPEED * time.delta_seconds();
if let Some(md) = md.as_mut() {
md.0 = dad.xy();
md.1 = dad.xy().length() * SPEED;
}
const DASH_SPEED: f32 = 700.0;
let speed = if dash.0 { DASH_SPEED } else { SPEED };
transform.translation += dad.xy().extend(0.0) * speed * time.delta_seconds();
md.0 = dad.xy();
md.1 = dad.xy().length() * speed * time.delta_seconds();