make ghost initial speed a little more granular
This commit is contained in:
parent
22656e9efa
commit
a0b48c76d1
1 changed files with 7 additions and 7 deletions
|
@ -1,18 +1,18 @@
|
||||||
tool
|
tool
|
||||||
extends "res://objects/enemy/enemy.gd"
|
extends "res://objects/enemy/enemy.gd"
|
||||||
|
|
||||||
## the radius the ghost orbits around
|
## radius in tiles the ghost orbits around
|
||||||
export var radius: float = 0.0
|
export var radius: float = 0.0
|
||||||
## initital rotation offset in full circles
|
## initital rotation offset in 8th circles
|
||||||
export var initial_angle: float = 0.0
|
export var initial_angle: float = 0.0
|
||||||
## speed the ghost revolves in cycles/second
|
## speed the ghost revolves in 8th cycles / second
|
||||||
export var speed: float = 0.0
|
export var speed: float = 0.0
|
||||||
|
|
||||||
onready var pivot: Node2D = $Pivot
|
onready var pivot: Node2D = $Pivot
|
||||||
onready var remote_transform: RemoteTransform2D = $Pivot/RemoteTransform
|
onready var remote_transform: RemoteTransform2D = $Pivot/RemoteTransform
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
pivot.rotation = TAU * initial_angle
|
pivot.rotation = initial_angle * 0.785398 # TAU / 8.0
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
if Engine.editor_hint:
|
if Engine.editor_hint:
|
||||||
|
@ -20,14 +20,14 @@ func _physics_process(delta: float) -> void:
|
||||||
# update radius
|
# update radius
|
||||||
remote_transform.position.x = radius * 8.0
|
remote_transform.position.x = radius * 8.0
|
||||||
# process rotation
|
# process rotation
|
||||||
pivot.rotation += speed * delta * 0.785398 # TAU / l8.0
|
pivot.rotation += speed * delta * 0.785398 # TAU / 8.0
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
if Engine.editor_hint and Engine.get_frames_drawn() % 10 == 0:
|
if Engine.editor_hint and Engine.get_frames_drawn() % 10 == 0:
|
||||||
get_node("Pivot").rotation = TAU * initial_angle
|
get_node("Pivot").rotation = initial_angle * 0.785398 # TAU / 8.0
|
||||||
get_node("Pivot/RemoteTransform").position.x = radius * 8.0
|
get_node("Pivot/RemoteTransform").position.x = radius * 8.0
|
||||||
update()
|
update()
|
||||||
|
|
||||||
func _draw() -> void:
|
func _draw() -> void:
|
||||||
if Engine.editor_hint:
|
if Engine.editor_hint:
|
||||||
draw_arc(Vector2(4.0, 4.0), radius * 8.0, 0.0, TAU, 13, Color(0.0, 1.0, 1.0, 0.1), 1.5)
|
draw_arc(Vector2(4.0, 4.0), radius * 8.0, 0.0, TAU, 17, Color(0.0, 1.0, 1.0, 0.1), 1.5)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue