diff options
author | IcECreAm777 <31211782+IcECreAm777@users.noreply.github.com> | 2022-07-17 02:49:09 +0200 |
---|---|---|
committer | IcECreAm777 <31211782+IcECreAm777@users.noreply.github.com> | 2022-07-17 02:49:09 +0200 |
commit | 4961e6a3f51990bb053cd8b18827e39aaf3e4e7c (patch) | |
tree | 41387099b13b6aca4ac69cdb3a1124a85825d600 /godot/scenes/Die.gd | |
parent | 88aeae3f02bfb19b83212599ac1eb950beb805b3 (diff) | |
parent | 8b932533e6d25a80f185bae299351426a4ca157e (diff) | |
download | 2022-4961e6a3f51990bb053cd8b18827e39aaf3e4e7c.tar.gz 2022-4961e6a3f51990bb053cd8b18827e39aaf3e4e7c.tar.bz2 2022-4961e6a3f51990bb053cd8b18827e39aaf3e4e7c.zip |
Merge branch 'Scoreboard'
Diffstat (limited to '')
-rw-r--r-- | godot/scenes/Die.gd | 59 |
1 files changed, 58 insertions, 1 deletions
diff --git a/godot/scenes/Die.gd b/godot/scenes/Die.gd index 1cbb9a0..6ccd16e 100644 --- a/godot/scenes/Die.gd +++ b/godot/scenes/Die.gd @@ -1,5 +1,7 @@ extends RigidBody +const Game = preload("res://scenes/Game.gd") + var camrot_h = 0 var camrot_v = 0 var camrot_v_locked_val = 0 @@ -15,12 +17,20 @@ var die_launch_force = Vector3(0,0,0) var die_launch_force_multiplier = 0.05 var left_pressed = false +var mat +var target_bounce = 1 +var previous_bounciness = 0 + +var _game: Game = null + # Called when the node enters the scene tree for the first time. func _ready(): Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) $CamRoot/Horizontal/Vertical/Camera.add_exception(self) $CamRoot.set_as_toplevel(true) - + _game = get_node("/root/Game") + mat = get_physics_material_override() + previous_bounciness = mat.get_bounce() func _input(event): @@ -60,6 +70,53 @@ func _physics_process(delta): dice_is_moving = true else: dice_is_moving = false + + if angular_velocity.length() == 0: + get_upwards_side() last_frame_position = Vector3(translation.x, translation.y, translation.x) + +# Called every frame. 'delta' is the elapsed time since the previous frame. +#func _process(delta): +# pass + + +""" +BUFFS +""" + +func get_upwards_side(): + return 0 + + +func extra_stroke(): + _game.revoke_stroke() + + +func bounciness(): + mat.set_bounce(target_bounce) + + +func bounciness_revert(): + mat.set_bounce(previous_bounciness) + + +func phase(): + set_collision_layer_bit(2, false) + + +func phase_revert(): + set_collision_layer_bit(2, true) + + +func ball(): + $BallShape.show() + $BallShape.set_process(true) + $BallShape.disabled = false + + +func ball_revert(): + $BallShape.hide() + $BallShape.set_process(false) + $BallShape.disabled = true |