Commit b78cfb5f authored by Nathan Lovato's avatar Nathan Lovato
Browse files

Reorder Gnu.gd's code to have private and virtual methods at the end of the file

parent fc6fdd5d
......@@ -23,25 +23,6 @@ var _target_angle = 0.0
var _active = true setget _set_active
func _ready():
self._idle = true
tween.connect("tween_completed", self, "_on_Tween_tween_completed")
func set_idle(value):
_idle = value
set_physics_process(not value)
if not _idle:
anim_player.play("idle")
func _unhandled_input(event):
if event.is_action_pressed("flap"):
if _idle:
self._idle = false
flap()
func flap():
_angular_velocity = 0.0
_velocity.y = -flap_force
......@@ -54,6 +35,43 @@ func flap():
tween.start()
func die():
self._active = false
tween.interpolate_property(
gnu_skeleton, 'scale',
gnu_skeleton.scale, Vector2(), 0.4,
Tween.TRANS_QUAD, Tween.EASE_OUT)
tween.start()
yield(tween, "tween_completed")
gnu_skeleton.rotation = 0.0
emit_signal('died')
func appear():
tween.stop_all()
tween.interpolate_property(
gnu_skeleton, 'scale',
gnu_skeleton.scale, gnu_skeleton.start_scale, 0.3,
Tween.TRANS_QUAD, Tween.EASE_OUT)
tween.start()
func dance():
gnu_skeleton.dance()
func set_idle(value):
_idle = value
set_physics_process(not value)
if not _idle:
anim_player.play("idle")
func _ready():
self._idle = true
tween.connect("tween_completed", self, "_on_Tween_tween_completed")
func _physics_process(delta):
_velocity.y += gravity * delta
_velocity.y = min(_velocity.y, max_fall_speed)
......@@ -72,16 +90,11 @@ func _physics_process(delta):
die()
func die():
self._active = false
tween.interpolate_property(
gnu_skeleton, 'scale',
gnu_skeleton.scale, Vector2(), 0.4,
Tween.TRANS_QUAD, Tween.EASE_OUT)
tween.start()
yield(tween, "tween_completed")
gnu_skeleton.rotation = 0.0
emit_signal('died')
func _unhandled_input(event):
if event.is_action_pressed("flap"):
if _idle:
self._idle = false
flap()
func _set_active(value):
......@@ -92,18 +105,6 @@ func _set_active(value):
collision_shape.disabled = not value
func appear():
tween.stop_all()
tween.interpolate_property(
gnu_skeleton, 'scale',
gnu_skeleton.scale, gnu_skeleton.start_scale, 0.3,
Tween.TRANS_QUAD, Tween.EASE_OUT)
tween.start()
func dance():
gnu_skeleton.dance()
func _on_Tween_tween_completed(object, key):
tween.stop_all()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment