summaryrefslogtreecommitdiff
path: root/src/entities/actors/snake/head/head.gd
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <david@luevano.xyz>2022-05-30 04:28:12 -0600
committerDavid Luevano Alvarado <david@luevano.xyz>2022-05-30 04:28:12 -0600
commit2838046928db956b7712d24dfb63ee45fbc4d050 (patch)
tree777be86f84a28498964578a826dad81bb14e7c5c /src/entities/actors/snake/head/head.gd
parent0aa26dc19da1c8907cd69d18b423c33f351d3f2f (diff)
add non-working segment system.. might need to go back to using rigidbodies
Diffstat (limited to 'src/entities/actors/snake/head/head.gd')
-rw-r--r--src/entities/actors/snake/head/head.gd21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/entities/actors/snake/head/head.gd b/src/entities/actors/snake/head/head.gd
index 222d091..96707b7 100644
--- a/src/entities/actors/snake/head/head.gd
+++ b/src/entities/actors/snake/head/head.gd
@@ -1,13 +1,10 @@
extends Node2D
-# export(float, 1.0, 1000.0, 1.0) var SPEED: float = 100.0
-# export(float, 1.0, 1000.0, 1.0) var ROT_SPEED: float = 200.0
-# export(float, 0.01, 1.0, 0.01) var POSITION_UPDATE_INTERVAL: float = 0.01
-var speed: float
-var rot_speed: float
-var position_update_interval: float
-
-var direction: Vector2 = Vector2.UP
+var speed: float = Global.SNAKE_SPEED
+var rot_speed: float = Global.SNAKE_ROT_SPEED
+var position_update_interval: float = Global.SNAKE_POSITION_UPDATE_INTERVAL
+
+var _direction: Vector2 = Vector2.UP
var _time_elapsed: float = 0.0
@@ -17,14 +14,14 @@ func _ready():
func _process(delta: float) -> void:
if Input.is_action_pressed("move_left"):
- # direction = direction.rotated(deg2rad(-ROT_SPEED))
+ # _direction = _direction.rotated(deg2rad(-ROT_SPEED))
rotate(deg2rad(-rot_speed * delta))
if Input.is_action_pressed("move_right"):
- # direction = direction.rotated(deg2rad(ROT_SPEED))
+ # _direction = _direction.rotated(deg2rad(ROT_SPEED))
rotate(deg2rad(rot_speed * delta))
- move_local_x(direction.x * speed * delta)
- move_local_y(direction.y * speed * delta)
+ move_local_x(_direction.x * speed * delta)
+ move_local_y(_direction.y * speed * delta)
_handle_time_elapsed(delta)