From 9c061b9997d0add3298b1230426dd7332b91420f Mon Sep 17 00:00:00 2001 From: IcECreAm777 <31211782+IcECreAm777@users.noreply.github.com> Date: Sat, 16 Jul 2022 21:09:11 +0200 Subject: goal post hitbox and level loader in gd script --- rust/src/game.rs | 1 - rust/src/goal_trigger.rs | 30 ++++++++++++++++++++++++++++++ rust/src/lib.rs | 2 ++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 rust/src/goal_trigger.rs (limited to 'rust') diff --git a/rust/src/game.rs b/rust/src/game.rs index ece5a54..7004f96 100644 --- a/rust/src/game.rs +++ b/rust/src/game.rs @@ -41,6 +41,5 @@ impl Game { // This function will be called in every frame #[export] unsafe fn _process(&self, _owner: &Spatial, delta: f64) { - godot_print!("Inside {} _process(), delta is {}", self.name, delta); } } diff --git a/rust/src/goal_trigger.rs b/rust/src/goal_trigger.rs new file mode 100644 index 0000000..457eb7b --- /dev/null +++ b/rust/src/goal_trigger.rs @@ -0,0 +1,30 @@ +use gdnative::api::*; +use gdnative::prelude::*; +use gdnative::core_types::VariantArray; +use gdnative::object::*; + +/// The SpinningCube "class" +#[derive(NativeClass)] +#[inherit(Node)] +pub struct GoalTriggerZone { + level_loader: Option>, +} + +#[methods] +impl GoalTriggerZone { + fn new(_owner: &Node) -> Self { + GoalTriggerZone { + level_loader: None, + } + } + + #[export] + unsafe fn _ready(&mut self, owner: &Node) { + // TODO get loader + } + + #[export] + fn overlap(&mut self, owner: &Node) { + godot_print!("OVERLAPPED"); + } +} diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 534955f..401b668 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -5,6 +5,7 @@ mod buff_phase; mod buff_trait; mod buff_ball; mod buff_extra; +pub mod goal_trigger; use gdnative::prelude::{godot_init, InitHandle}; @@ -12,6 +13,7 @@ use gdnative::prelude::{godot_init, InitHandle}; fn init(handle: InitHandle) { handle.add_class::(); handle.add_class::(); + handle.add_class::(); } // macros that create the entry-points of the dynamic library. -- cgit