diff options
author | IcECreAm777 <31211782+IcECreAm777@users.noreply.github.com> | 2022-07-17 05:23:06 +0200 |
---|---|---|
committer | IcECreAm777 <31211782+IcECreAm777@users.noreply.github.com> | 2022-07-17 05:23:06 +0200 |
commit | ee5124e87ac68b3628fcaa7f08a56fa139449014 (patch) | |
tree | 4c93cc29c480c53ded44d28b82f26d40c5943c85 /godot/scenes/Die.gd | |
parent | fab6add55efe3fe00c8eec75d71514bd4085ba6e (diff) | |
parent | 924cca25c4ba3f8503f2455082491d574720aaec (diff) | |
download | 2022-ee5124e87ac68b3628fcaa7f08a56fa139449014.tar.gz 2022-ee5124e87ac68b3628fcaa7f08a56fa139449014.tar.bz2 2022-ee5124e87ac68b3628fcaa7f08a56fa139449014.zip |
Merge branch 'Facing'
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(): |