Skip to content

Commit

Permalink
abstract experiment: self.base
Browse files Browse the repository at this point in the history
  • Loading branch information
PgBiel committed Nov 4, 2023
1 parent 0f4131c commit 936dd1d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions examples/dodge-the-creeps/rust/src/mob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ pub struct Mob2 {
base: Base<Mob>,
}

#[godot_api]
impl Mob2 {
#[func]
fn do_thing_idk(&mut self) {
godot_print!("hello world!");
self.base.bind_mut().amongus();
godot_print!("Bye!");
self.base.add_child(RigidBody2D::new_alloc().upcast());
godot_print!("M!");
}
}

#[derive(GodotClass)]
#[class(base=RigidBody2D)]
pub struct Mob {
Expand All @@ -33,6 +45,11 @@ impl Mob {
fn on_start_game(&mut self) {
self.base.queue_free();
}

#[func]
fn amongus(&mut self) {
godot_print!("Hi I'm amongus");
}
}

#[godot_api]
Expand Down

0 comments on commit 936dd1d

Please sign in to comment.