Improve code formatting and update to 2.0

The scripts were streamlined using more or less the following conventions:
 - space after a comma in lists of arguments
 - space around weak operators (+, -), no space around strong 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

The scene files were resaved with the (current) 2.0 format, and some scenes that were in XML format were converted to SCN, to be consistent across all demos.
This commit is contained in:
Rémi Verschelde
2015-12-09 08:38:23 +01:00
parent 94521880de
commit 708a0caf4a
95 changed files with 505 additions and 5637 deletions

View File

@@ -1,16 +1,17 @@
extends Spatial
# member variables
var r_pos = Vector2()
var state
const STATE_MENU=0
const STATE_GRAB=1
const STATE_MENU = 0
const STATE_GRAB = 1
func direction(vector):
var v = get_node("Camera").get_global_transform().basis * vector
var v = get_node("Camera").get_global_transform().basis*vector
v = v.normalized()
return v
@@ -22,7 +23,6 @@ func impulse(event, action):
func _fixed_process(delta):
if(state != STATE_GRAB):
return
@@ -34,31 +34,31 @@ func _fixed_process(delta):
var org = get_translation()
if (Input.is_action_pressed("move_forward")):
dir += direction(Vector3(0,0,-1))
dir += direction(Vector3(0, 0, -1))
if (Input.is_action_pressed("move_backwards")):
dir += direction(Vector3(0,0,1))
dir += direction(Vector3(0, 0, 1))
if (Input.is_action_pressed("move_left")):
dir += direction(Vector3(-1,0,0))
dir += direction(Vector3(-1, 0, 0))
if (Input.is_action_pressed("move_right")):
dir += direction(Vector3(1,0,0))
dir += direction(Vector3(1, 0, 0))
dir = dir.normalized()
move(dir * 10 * delta)
var d = delta * 0.1
move(dir*10*delta)
var d = delta*0.1
var yaw = get_transform().rotated(Vector3(0,1,0), d * r_pos.x)
var yaw = get_transform().rotated(Vector3(0, 1, 0), d*r_pos.x)
set_transform(yaw)
var cam = get_node("Camera")
var pitch = cam.get_transform().rotated(Vector3(1,0,0), d * r_pos.y)
var pitch = cam.get_transform().rotated(Vector3(1, 0, 0), d*r_pos.y)
cam.set_transform(pitch)
r_pos.x = 0.0
r_pos.y = 0.0
func _input( event ):
func _input(event):
if(event.type == InputEvent.MOUSE_MOTION):
r_pos = event.relative_pos
@@ -76,4 +76,3 @@ func _ready():
set_process_input(true)
state = STATE_MENU