Skip to content

Commit

Permalink
Merge #253
Browse files Browse the repository at this point in the history
253: DTC example - Don't `_process` on player in editor r=Bromeon a=Lamby777

Same bug we went over on the Discord channel.

Prevents this stuff from happening in the editor:
![image](https://user-images.githubusercontent.com/35111165/235373942-9da696f3-9c9e-430e-bc71-327010524058.png)

...at least, until #70 is resolved. Then, this can be removed, since it's not necessary.

Co-authored-by: Dex <[email protected]>
  • Loading branch information
bors[bot] and Lamby777 authored May 1, 2023
2 parents 0626d94 + 6ba911e commit ca5e331
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion examples/dodge-the-creeps/rust/src/player.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use godot::engine::{AnimatedSprite2D, Area2D, Area2DVirtual, CollisionShape2D, PhysicsBody2D};
use godot::engine::{
AnimatedSprite2D, Area2D, Area2DVirtual, CollisionShape2D, Engine, PhysicsBody2D,
};
use godot::prelude::*;

#[derive(GodotClass)]
Expand Down Expand Up @@ -58,6 +60,12 @@ impl Area2DVirtual for Player {
}

fn process(&mut self, delta: f64) {
// Don't process if running in editor. This part should be removed when
// issue is resolved: https://github.com/godot-rust/gdext/issues/70
if Engine::singleton().is_editor_hint() {
return;
}

let mut animated_sprite = self
.base
.get_node_as::<AnimatedSprite2D>("AnimatedSprite2D");
Expand Down

0 comments on commit ca5e331

Please sign in to comment.