diff options
author | David Luevano Alvarado <david@luevano.xyz> | 2022-06-03 21:13:19 -0600 |
---|---|---|
committer | David Luevano Alvarado <david@luevano.xyz> | 2022-06-03 21:13:19 -0600 |
commit | f922fe4669080d1633e0a345a3f8981867c9e841 (patch) | |
tree | 7c2c98bfca20fda37fe34ba99e2d3caa9a39ca02 /src/entities/actors/snake/scripts/head.gd | |
parent | 898877f09808691a5e5d45850d27ae85f270db16 (diff) |
add working world gen, fixed food placing, minor refactoring
Diffstat (limited to 'src/entities/actors/snake/scripts/head.gd')
-rw-r--r-- | src/entities/actors/snake/scripts/head.gd | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/entities/actors/snake/scripts/head.gd b/src/entities/actors/snake/scripts/head.gd index 448802e..117f461 100644 --- a/src/entities/actors/snake/scripts/head.gd +++ b/src/entities/actors/snake/scripts/head.gd @@ -5,6 +5,7 @@ enum { RIGHT=1 } +var _initial_speed: float = Global.SNAKE_SPEED var velocity: Vector2 = Vector2.ZERO var _direction: Vector2 = Vector2.UP var _time_elapsed: float = 0.0 @@ -26,6 +27,7 @@ func _physics_process(delta: float) -> void: func _rotate_to(direction: int) -> void: rotate(deg2rad(direction * Global.SNAKE_ROT_SPEED * get_physics_process_delta_time())) _direction = _direction.rotated(deg2rad(direction * Global.SNAKE_ROT_SPEED * get_physics_process_delta_time())) + Event.emit_signal("snake_rotated") # using a timer is not recommended for < 0.01 |