From 2463d0532a63ae4d7f67dbd56d9d886b214b2ac5 Mon Sep 17 00:00:00 2001 From: IcECreAm777 <31211782+IcECreAm777@users.noreply.github.com> Date: Sun, 17 Jul 2022 05:50:52 +0200 Subject: finished base die --- godot/scenes/Die.gd | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'godot/scenes') diff --git a/godot/scenes/Die.gd b/godot/scenes/Die.gd index 6f061b5..76c1474 100644 --- a/godot/scenes/Die.gd +++ b/godot/scenes/Die.gd @@ -22,6 +22,8 @@ var mat var target_bounce = 1 var previous_bounciness = 0 +var curr_buff = buff.none + var _game: Game = null enum buff { @@ -101,7 +103,10 @@ func _physics_process(delta): if dice_is_moving == true and angular_velocity.length() < 0.01 and linear_velocity.length() < 0.01: dice_is_moving = false - get_buff_from_upwards_side() + revert_current_buff() + curr_buff = get_buff_from_upwards_side() + apply_buff() + elif dice_is_moving == false and angular_velocity.length() >= 0.01 and linear_velocity.length() >= 0.01: dice_is_moving = true @@ -158,3 +163,25 @@ func ball_revert(): $BallShape.hide() $BallShape.set_process(false) $BallShape.disabled = true + + +func revert_current_buff(): + match curr_buff: + buff.ball: + ball_revert() + buff.bounce: + bounciness_revert() + buff.phase: + phase_revert() + + +func apply_buff(): + match curr_buff: + buff.ball: + ball() + buff.bounce: + bounciness() + buff.phase: + phase() + buff.stroke: + extra_stroke() -- cgit