From 18ab11eeb4464626fe27cbc8296967be0f5de993 Mon Sep 17 00:00:00 2001 From: IcECreAm777 <31211782+IcECreAm777@users.noreply.github.com> Date: Sun, 17 Jul 2022 12:44:10 +0200 Subject: fixed reapplying buff bug --- godot/scenes/Die.gd | 10 +++++----- godot/scenes/Die.tscn | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/godot/scenes/Die.gd b/godot/scenes/Die.gd index 0d11d73..3b3a5e7 100644 --- a/godot/scenes/Die.gd +++ b/godot/scenes/Die.gd @@ -21,6 +21,7 @@ var mat var target_bounce = 10 var default_gravity = 2 var default_bounciness = 0 +var after_stroke = false var curr_buff = buff.none @@ -83,6 +84,7 @@ func _input(event): self.apply_torque_impulse(die_launch_force) $PowerUI/PowerBar.hide() _game.add_stroke() + after_stroke = true #Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) # add one to counter @@ -108,6 +110,9 @@ func _physics_process(delta): if dice_is_moving == true and angular_velocity.length() < 0.1 and linear_velocity.length() < 0.1: if curr_buff != buff.ball: dice_is_moving = false + if !after_stroke: + return + after_stroke = false revert_current_buff() var last_buff = curr_buff curr_buff = get_buff_from_upwards_side() @@ -119,11 +124,6 @@ func _physics_process(delta): dice_is_moving = true -# Called every frame. 'delta' is the elapsed time since the previous frame. -#func _process(delta): -# pass - - """ BUFFS """ diff --git a/godot/scenes/Die.tscn b/godot/scenes/Die.tscn index bab53ad..75f7223 100644 --- a/godot/scenes/Die.tscn +++ b/godot/scenes/Die.tscn @@ -32,6 +32,7 @@ surfaces/0 = { radius = 0.1 [node name="Die" type="RigidBody"] +collision_layer = 3 collision_mask = 3 physics_material_override = SubResource( 7 ) linear_damp = 0.0 -- cgit