aboutsummaryrefslogtreecommitdiffstats
path: root/godot/scenes/Die.gd
diff options
context:
space:
mode:
Diffstat (limited to 'godot/scenes/Die.gd')
-rw-r--r--godot/scenes/Die.gd59
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