diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-12-09 09:10:00 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-12-09 09:10:00 -0300 |
commit | aadced2f72476f637c6c14e48d3811e088eda951 (patch) | |
tree | 34df51f29d92225f28dcdfc495b8796ae7430ceb /demos/2d/platformer/moving_platform.gd | |
parent | 6bc6b8fcf24bdfcae4a990054c9077e1bc5a87e5 (diff) | |
parent | db9da152765357c5e484792fc5e31a25acbc7616 (diff) |
Merge branch 'master' of https://github.com/godotengine/godot
Diffstat (limited to 'demos/2d/platformer/moving_platform.gd')
-rw-r--r-- | demos/2d/platformer/moving_platform.gd | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/demos/2d/platformer/moving_platform.gd b/demos/2d/platformer/moving_platform.gd index 719d9e460e..21c312d5c3 100644 --- a/demos/2d/platformer/moving_platform.gd +++ b/demos/2d/platformer/moving_platform.gd @@ -1,27 +1,20 @@ extends Node2D -# member variables here, example: -# var a=2 -# var b="textvar" - +# Member variables export var motion = Vector2() export var cycle = 1.0 -var accum=0.0 +var accum = 0.0 -func _fixed_process(delta): - accum += delta * (1.0/cycle) * PI * 2.0 - accum = fmod(accum,PI*2.0) +func _fixed_process(delta): + accum += delta*(1.0/cycle)*PI*2.0 + accum = fmod(accum, PI*2.0) var d = sin(accum) var xf = Matrix32() - xf[2]= motion * d + xf[2]= motion*d get_node("platform").set_transform(xf) - + func _ready(): - # Initalization here set_fixed_process(true) - pass - - |