2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
extends Node2D
|
|
|
|
|
2015-11-21 16:13:43 +01:00
|
|
|
# Member variables
|
2014-02-10 02:10:30 +01:00
|
|
|
export var motion = Vector2()
|
|
|
|
export var cycle = 1.0
|
2015-11-21 16:13:43 +01:00
|
|
|
var accum = 0.0
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
|
2015-11-21 16:13:43 +01:00
|
|
|
func _fixed_process(delta):
|
|
|
|
accum += delta*(1.0/cycle)*PI*2.0
|
|
|
|
accum = fmod(accum, PI*2.0)
|
2014-02-10 02:10:30 +01:00
|
|
|
var d = sin(accum)
|
|
|
|
var xf = Matrix32()
|
2015-11-21 16:13:43 +01:00
|
|
|
xf[2]= motion*d
|
2014-02-10 02:10:30 +01:00
|
|
|
get_node("platform").set_transform(xf)
|
2015-11-21 16:13:43 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
func _ready():
|
|
|
|
# Initalization here
|
|
|
|
set_fixed_process(true)
|