From 9cb0b053b337742aae96517a8c5c4700698faa03 Mon Sep 17 00:00:00 2001 From: IcECreAm777 <31211782+IcECreAm777@users.noreply.github.com> Date: Sun, 17 Jul 2022 12:20:31 +0200 Subject: fixed: bounce works again and +1 can't be activated twice in a row gravity is deactivated for now --- godot/scenes/Die.gd | 11 +++++++---- godot/scenes/Game.gd | 9 +++------ godot/scenes/levels/MainMenu.tscn | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'godot') diff --git a/godot/scenes/Die.gd b/godot/scenes/Die.gd index 1f82417..0d11d73 100644 --- a/godot/scenes/Die.gd +++ b/godot/scenes/Die.gd @@ -109,7 +109,10 @@ func _physics_process(delta): if curr_buff != buff.ball: dice_is_moving = false revert_current_buff() + var last_buff = curr_buff curr_buff = get_buff_from_upwards_side() + if last_buff == curr_buff && curr_buff == buff.stroke: + return apply_buff() elif dice_is_moving == false and angular_velocity.length() >= 0.1 and linear_velocity.length() >= 0.1: @@ -137,7 +140,7 @@ func get_buff_from_upwards_side(): if $Ball1.get_overlapping_areas().size() > 0 || $Ball2.get_overlapping_areas().size() > 0: return buff.ball if $Bounce1.get_overlapping_areas().size() > 0 || $Bounce2.get_overlapping_areas().size() > 0: - return buff.gravity + return buff.bounce if $Phase1.get_overlapping_areas().size() > 0 || $Phase2.get_overlapping_areas().size() > 0: return buff.phase @@ -193,15 +196,15 @@ func revert_current_buff(): gravity_scale = default_gravity func apply_buff(): + gravity_scale = default_gravity match curr_buff: buff.ball: - gravity_scale = default_gravity ball() buff.bounce: - gravity_scale = default_gravity bounciness() buff.phase: phase() - gravity_scale = default_gravity buff.stroke: + extra_stroke() + buff.gravity: low_gravity() diff --git a/godot/scenes/Game.gd b/godot/scenes/Game.gd index d2dc2ed..56456c0 100644 --- a/godot/scenes/Game.gd +++ b/godot/scenes/Game.gd @@ -47,13 +47,8 @@ func _on_MainMenuButton_pressed(): func end_level(): - # save current strokes and reset - strokes_per_level[current_level_id] = current_strokes - current_strokes = 0 - + open_scoreboard() post_game = true - - open_scoreboard() func add_stroke(): @@ -84,6 +79,8 @@ func next_level(): levels[current_level_id].hide() current_level_id = current_level_id + 1 + current_strokes = 0 + if current_level_id >= NUM_LEVELS: get_tree().change_scene("res://scenes/levels/MainMenu.tscn") return diff --git a/godot/scenes/levels/MainMenu.tscn b/godot/scenes/levels/MainMenu.tscn index b06a027..438de12 100644 --- a/godot/scenes/levels/MainMenu.tscn +++ b/godot/scenes/levels/MainMenu.tscn @@ -22,7 +22,7 @@ void vertex() { void fragment() { // Color:2 - vec3 n_out2p0 = vec3(0.042878, 0.101562, 0.036245); + vec3 n_out2p0 = vec3(0.042879, 0.101562, 0.036245); float n_out2p1 = 1.000000; // Output:0 -- cgit