From 7589b2bf605b58fbb0e34dec8ae833708e9b54ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sat, 21 Nov 2015 16:13:43 +0100 Subject: Improve code formatting The scripts were streamlined using more or less the following conventions: - space after a comma in lists of arguments - spaces around weak operators (+, -), no spaces around strong operators (*, /) - spaces around comparison operators and compound assignment operators - space after a comment start (#) - removed trailing spaces or tabs, apart from those that delimit the function indentation level (those could be removed too but since they are added automatically by the editor when typing code, keeping them for now) - function blocks separate by two newlines - comment sentences start with an upper-case letter --- demos/2d/platformer/moving_platform.gd | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'demos/2d/platformer/moving_platform.gd') diff --git a/demos/2d/platformer/moving_platform.gd b/demos/2d/platformer/moving_platform.gd index 719d9e460e..db75f6db6c 100644 --- a/demos/2d/platformer/moving_platform.gd +++ b/demos/2d/platformer/moving_platform.gd @@ -1,27 +1,21 @@ 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 - - -- cgit v1.2.3