finish hello world just to be sure physics process werks
parent
b04ab122eb
commit
a2f4fce705
|
|
@ -8,12 +8,16 @@ struct BreeLPlayer {
|
||||||
#[godot_api]
|
#[godot_api]
|
||||||
impl ISprite2D for BreeLPlayer {
|
impl ISprite2D for BreeLPlayer {
|
||||||
fn init(base: Base<Sprite2D>) -> Self {
|
fn init(base: Base<Sprite2D>) -> Self {
|
||||||
eprintln!("init");
|
|
||||||
BreeLPlayer{base: base}
|
BreeLPlayer{base: base}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn physics_process(&mut self, delta: f64) {
|
fn physics_process(&mut self, delta: f64) {
|
||||||
eprintln!("physics_process({delta})");
|
let radians = (1.0 * delta) as f32;
|
||||||
|
self.base_mut().rotate(radians);
|
||||||
|
|
||||||
|
let rotation = self.base().get_rotation();
|
||||||
|
let velocity = Vector2::UP.rotated(rotation) * 200 as f32;
|
||||||
|
self.base_mut().translate(velocity * delta as f32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue