From 7e66ac4ff518e6aa091c7ccfe567e31fa1f51994 Mon Sep 17 00:00:00 2001 From: IcECreAm777 <31211782+IcECreAm777@users.noreply.github.com> Date: Sun, 17 Jul 2022 04:32:58 +0200 Subject: made sure strokes are updated after each one --- godot/scenes/Die.gd | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'godot/scenes/Die.gd') diff --git a/godot/scenes/Die.gd b/godot/scenes/Die.gd index 9341bc1..878b7be 100644 --- a/godot/scenes/Die.gd +++ b/godot/scenes/Die.gd @@ -14,7 +14,7 @@ var mouse_origin = Vector2(0,0) var die_launch_force_magnitude = 0 var die_launch_force_direction = Vector3(0,0,0) var die_launch_force = Vector3(0,0,0) -var die_launch_force_multiplier = 0.05 +var die_launch_force_multiplier = 0.001 var left_pressed = false var mat @@ -60,8 +60,9 @@ func _input(event): die_launch_force_direction = $CamRoot/Horizontal/Vertical/Camera.get_global_transform().basis die_launch_force_direction = -die_launch_force_direction.z die_launch_force = die_launch_force_direction * die_launch_force_magnitude * die_launch_force_multiplier - self.apply_central_impulse(die_launch_force) + self.apply_impulse(global_transform.origin, die_launch_force) Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) + _game.add_stroke() if event is InputEventMouseMotion: camrot_h += -event.relative.x * sensitivity -- cgit From 3aab06c6763fc5ad3396bd5451c100364afeb76b Mon Sep 17 00:00:00 2001 From: IcECreAm777 <31211782+IcECreAm777@users.noreply.github.com> Date: Sun, 17 Jul 2022 05:18:57 +0200 Subject: buff detection --- godot/scenes/Die.gd | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'godot/scenes/Die.gd') diff --git a/godot/scenes/Die.gd b/godot/scenes/Die.gd index 878b7be..aec80a5 100644 --- a/godot/scenes/Die.gd +++ b/godot/scenes/Die.gd @@ -23,6 +23,14 @@ var previous_bounciness = 0 var _game: Game = null +enum buff { + none, + stroke, + bounce, + phase, + ball +} + # Called when the node enters the scene tree for the first time. func _ready(): Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) @@ -87,7 +95,7 @@ func _physics_process(delta): dice_is_moving = false if angular_velocity.length() == 0: - get_upwards_side() + get_buff_from_upwards_side() last_frame_position = Vector3(translation.x, translation.y, translation.x) @@ -101,8 +109,21 @@ func _physics_process(delta): BUFFS """ -func get_upwards_side(): - return 0 +func get_buff_from_upwards_side(): + if $Plus1.get_overlapping_areas().size() > 0 || $Plus2.get_overlapping_areas().size() > 0: + print("buff: plus") + return buff.stroke + if $Ball1.get_overlapping_areas().size() > 0 || $Ball2.get_overlapping_areas().size() > 0: + print("buff: ball") + return buff.ball + if $Bounce1.get_overlapping_areas().size() > 0 || $Bounce2.get_overlapping_areas().size() > 0: + print("buff: bounce") + return buff.bounce + if $Phase1.get_overlapping_areas().size() > 0 || $Phase2.get_overlapping_areas().size() > 0: + print("buff: phase") + return buff.phase + + return buff.none func extra_stroke(): -- cgit From 924cca25c4ba3f8503f2455082491d574720aaec Mon Sep 17 00:00:00 2001 From: IcECreAm777 <31211782+IcECreAm777@users.noreply.github.com> Date: Sun, 17 Jul 2022 05:19:23 +0200 Subject: removed prints --- godot/scenes/Die.gd | 4 ---- 1 file changed, 4 deletions(-) (limited to 'godot/scenes/Die.gd') diff --git a/godot/scenes/Die.gd b/godot/scenes/Die.gd index aec80a5..66eb02c 100644 --- a/godot/scenes/Die.gd +++ b/godot/scenes/Die.gd @@ -111,16 +111,12 @@ BUFFS func get_buff_from_upwards_side(): if $Plus1.get_overlapping_areas().size() > 0 || $Plus2.get_overlapping_areas().size() > 0: - print("buff: plus") return buff.stroke if $Ball1.get_overlapping_areas().size() > 0 || $Ball2.get_overlapping_areas().size() > 0: - print("buff: ball") return buff.ball if $Bounce1.get_overlapping_areas().size() > 0 || $Bounce2.get_overlapping_areas().size() > 0: - print("buff: bounce") return buff.bounce if $Phase1.get_overlapping_areas().size() > 0 || $Phase2.get_overlapping_areas().size() > 0: - print("buff: phase") return buff.phase return buff.none -- cgit