diff options
Diffstat (limited to 'godot/scenes/Die.gd')
-rw-r--r-- | godot/scenes/Die.gd | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/godot/scenes/Die.gd b/godot/scenes/Die.gd index 558af14..f7d51d5 100644 --- a/godot/scenes/Die.gd +++ b/godot/scenes/Die.gd @@ -24,6 +24,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) @@ -92,11 +100,9 @@ func _physics_process(delta): if dice_is_moving == true and angular_velocity.length() < 0.01 and linear_velocity.length() < 0.01: dice_is_moving = false - get_upwards_side() + get_buff_from_upwards_side() elif dice_is_moving == false and angular_velocity.length() >= 0.01 and linear_velocity.length() >= 0.01: dice_is_moving = true - - # Called every frame. 'delta' is the elapsed time since the previous frame. @@ -108,8 +114,17 @@ 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: + return buff.stroke + 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.bounce + if $Phase1.get_overlapping_areas().size() > 0 || $Phase2.get_overlapping_areas().size() > 0: + return buff.phase + + return buff.none func extra_stroke(): |