Skip to content

Commit

Permalink
Fix rotation limits
Browse files Browse the repository at this point in the history
  • Loading branch information
Dariasteam committed Feb 19, 2019
1 parent eeb2a3e commit 149788e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Scenes/Player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -143,17 +143,17 @@ func _on_set_rotation (rot):
var diff_b = abs(current_rotation - local_rotation_range.y)

if (diff_a < diff_b):
intent_rotation = rotation_range.x - 1
intent_rotation = rotation_range.x - 0.1
else:
intent_rotation = rotation_range.y + 1
intent_rotation = rotation_range.y + 0.1

has_collided = true

if (current_rotation < local_rotation_range.x and intent_rotation > local_rotation_range.x):
intent_rotation = local_rotation_range.x - 1
intent_rotation = local_rotation_range.x - 0.1
has_collided = true
if (current_rotation > local_rotation_range.y and intent_rotation < local_rotation_range.y):
intent_rotation = local_rotation_range.y + 1
intent_rotation = local_rotation_range.y + 0.1
has_collided = true

set_player_rotation(intent_rotation)
Expand Down
3 changes: 2 additions & 1 deletion Scenes/platform.gd
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ func _ready():
aux.set_translation(Vector3(0,rand_range(-0.01, 0.01), 0))
aux.set_material (global.mat_regular)
elif (rand == 15 and !cant_move):
allowed_range = Vector2(rot - offset - 14, rot + 7)
var segment_width = offset / 2;
allowed_range = Vector2(rot - offset - segment_width, rot - 2)
cant_move = true
aux = segment_tall.instance()
aux.set_material (global.mat_regular)
Expand Down

0 comments on commit 149788e

Please sign in to comment.