Initial work on proper character movement
This commit is contained in:
+13
-4
@@ -3,6 +3,8 @@
|
||||
|
||||
use bevy::prelude::*;
|
||||
|
||||
use crate::fighter::FighterAttributes;
|
||||
|
||||
#[derive(Component, Clone, Copy)]
|
||||
pub struct Grounded;
|
||||
|
||||
@@ -16,20 +18,27 @@ pub struct FighterPreviousTranslation(pub Vec2);
|
||||
#[require(FighterPreviousTranslation)]
|
||||
pub struct FighterTranslation(pub Vec2);
|
||||
|
||||
pub fn integrate_gravity(_fighters: Query<&mut FighterVelocity>, _time: Res<Time<Fixed>>) {}
|
||||
|
||||
pub fn apply_motion(
|
||||
pub fn apply_air_motion(
|
||||
fighters: Query<(
|
||||
&FighterVelocity,
|
||||
&mut FighterTranslation,
|
||||
&mut FighterPreviousTranslation,
|
||||
&mut Transform,
|
||||
)>,
|
||||
_time: Res<Time<Fixed>>,
|
||||
) {
|
||||
for (velocity, mut translation, mut prev_translation) in fighters {
|
||||
for (velocity, mut translation, mut prev_translation, mut transform) in fighters {
|
||||
prev_translation.0 = translation.0;
|
||||
translation.0 += velocity.0;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn copy_fighter_transform_to_visuals(
|
||||
fighters: Query<(&FighterTranslation, &mut Transform)>,
|
||||
) {
|
||||
for (translation, mut transform) in fighters {
|
||||
transform.translation = Vec3::new(translation.x, translation.y, 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn fighter_movement() {}
|
||||
|
||||
Reference in New Issue
Block a user