summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2015-11-21 13:31:25 +0100
committerRémi Verschelde <rverschelde@gmail.com>2015-12-09 08:39:12 +0100
commit8c4f19e79d3e8ac8bc8c283073dce5ccfbf222b5 (patch)
treec1124b6d4957389006024d1e1baa5de56e207fec
parent8639cecf4cedd56452b47503be19c44b304cd02f (diff)
Use upper-cased first letter at the start of comment sentences
-rw-r--r--demos/3d/kinematic_char/cubio.gd10
-rw-r--r--demos/3d/kinematic_char/follow_camera.gd14
-rw-r--r--demos/3d/mousepick_test/mousepick.gd4
-rw-r--r--demos/3d/navmesh/navmesh.gd4
-rw-r--r--demos/3d/platformer/bullet.gd4
-rw-r--r--demos/3d/platformer/coin.gd4
-rw-r--r--demos/3d/platformer/enemy.gd6
-rw-r--r--demos/3d/platformer/follow_camera.gd89
-rw-r--r--demos/3d/platformer/player.gd34
-rw-r--r--demos/3d/truck_town/car_select.gd2
-rw-r--r--demos/3d/truck_town/follow_camera.gd14
-rw-r--r--demos/3d/truck_town/vehicle.gd2
-rw-r--r--demos/gui/drag_and_drop/drag_drop_script.gd4
-rw-r--r--demos/gui/input_mapping/controls.gd7
-rw-r--r--demos/gui/translation/main.gd2
-rw-r--r--demos/misc/autoload/global.gd4
-rw-r--r--demos/misc/autoload/scene_a.gd4
-rw-r--r--demos/misc/autoload/scene_b.gd4
-rw-r--r--demos/misc/joysticks/joysticks.gd10
-rw-r--r--demos/misc/regex/regex.gd2
-rw-r--r--demos/misc/scene_changer/scene_a.gd4
-rw-r--r--demos/misc/scene_changer/scene_b.gd4
-rw-r--r--demos/misc/threads/thread.gd16
-rw-r--r--demos/misc/tween/main.gd2
-rw-r--r--demos/misc/udp_chat/chat.gd2
-rw-r--r--demos/misc/window_management/control.gd2
-rw-r--r--demos/misc/window_management/observer/observer.gd4
-rw-r--r--demos/viewport/2d_in_3d/pong.gd28
-rw-r--r--demos/viewport/gui_in_3d/gui_3d.gd16
-rw-r--r--demos/viewport/screen_capture/screen_capture.gd12
30 files changed, 150 insertions, 164 deletions
diff --git a/demos/3d/kinematic_char/cubio.gd b/demos/3d/kinematic_char/cubio.gd
index d2bd00bd0f..c4d8276181 100644
--- a/demos/3d/kinematic_char/cubio.gd
+++ b/demos/3d/kinematic_char/cubio.gd
@@ -1,7 +1,7 @@
extends KinematicBody
-# member variables
+# Member variables
var g = -9.8
var vel = Vector3()
const MAX_SPEED = 5
@@ -12,7 +12,7 @@ const MAX_SLOPE_ANGLE = 30
func _fixed_process(delta):
- var dir = Vector3() #where does the player intend to walk to
+ var dir = Vector3() # Where does the player intend to walk to
var cam_xform = get_node("target/camera").get_global_transform()
if (Input.is_action_pressed("move_forward")):
@@ -49,13 +49,13 @@ func _fixed_process(delta):
var on_floor = false
var original_vel = vel
var floor_velocity = Vector3()
- var attempts=4
+ var attempts = 4
while(is_colliding() and attempts):
var n = get_collision_normal()
if (rad2deg(acos(n.dot(Vector3(0, 1, 0)))) < MAX_SLOPE_ANGLE):
- # if angle to the "up" vectors is < angle tolerance
+ # If angle to the "up" vectors is < angle tolerance,
# char is on floor
floor_velocity = get_collider_velocity()
on_floor = true
@@ -63,7 +63,7 @@ func _fixed_process(delta):
motion = n.slide(motion)
vel = n.slide(vel)
if (original_vel.dot(vel) > 0):
- # do not allow to slide towads the opposite direction we were coming from
+ # Do not allow to slide towads the opposite direction we were coming from
motion=move(motion)
if (motion.length() < 0.001):
break
diff --git a/demos/3d/kinematic_char/follow_camera.gd b/demos/3d/kinematic_char/follow_camera.gd
index 852b20a398..37a1402053 100644
--- a/demos/3d/kinematic_char/follow_camera.gd
+++ b/demos/3d/kinematic_char/follow_camera.gd
@@ -1,7 +1,7 @@
extends Camera
-# member variables
+# Member variables
var collision_exception = []
export var min_distance = 0.5
export var max_distance = 4.0
@@ -19,15 +19,15 @@ func _fixed_process(dt):
var delta = pos - target
- # regular delta follow
+ # Regular delta follow
- # check ranges
+ # Check ranges
if (delta.length() < min_distance):
delta = delta.normalized()*min_distance
elif (delta.length() > max_distance):
delta = delta.normalized()*max_distance
- # check upper and lower height
+ # Check upper and lower height
if (delta.y > max_height):
delta.y = max_height
if (delta.y < min_height):
@@ -37,14 +37,14 @@ func _fixed_process(dt):
look_at_from_pos(pos, target, up)
- # turn a little up or down
+ # Turn a little up or down
var t = get_transform()
t.basis = Matrix3(t.basis[0], deg2rad(angle_v_adjust))*t.basis
set_transform(t)
func _ready():
- # find collision exceptions for ray
+ # Find collision exceptions for ray
var node = self
while(node):
if (node extends RigidBody):
@@ -53,5 +53,5 @@ func _ready():
else:
node = node.get_parent()
set_fixed_process(true)
- # this detaches the camera transform from the parent spatial node
+ # This detaches the camera transform from the parent spatial node
set_as_toplevel(true)
diff --git a/demos/3d/mousepick_test/mousepick.gd b/demos/3d/mousepick_test/mousepick.gd
index c250c7f084..674ec7ff6f 100644
--- a/demos/3d/mousepick_test/mousepick.gd
+++ b/demos/3d/mousepick_test/mousepick.gd
@@ -1,9 +1,9 @@
extends RigidBody
-# member variables
+# Member variables
var gray_mat = FixedMaterial.new()
-var selected=false
+var selected = false
func _input_event(camera, event, pos, normal, shape):
diff --git a/demos/3d/navmesh/navmesh.gd b/demos/3d/navmesh/navmesh.gd
index 87b0e1d2cc..f3eaf766d2 100644
--- a/demos/3d/navmesh/navmesh.gd
+++ b/demos/3d/navmesh/navmesh.gd
@@ -1,7 +1,7 @@
extends Navigation
-# member variables
+# Member variables
const SPEED = 4.0
var camrot = 0.0
@@ -11,7 +11,7 @@ var end = Vector3()
var m = FixedMaterial.new()
var path = []
-var draw_path=false
+var draw_path = false
func _process(delta):
diff --git a/demos/3d/platformer/bullet.gd b/demos/3d/platformer/bullet.gd
index 4709273535..29219403bd 100644
--- a/demos/3d/platformer/bullet.gd
+++ b/demos/3d/platformer/bullet.gd
@@ -1,5 +1,5 @@
extends RigidBody
-# member variables
-var disabled=false
+# Member variables
+var disabled = false
diff --git a/demos/3d/platformer/coin.gd b/demos/3d/platformer/coin.gd
index ef84014931..bd2eea81e2 100644
--- a/demos/3d/platformer/coin.gd
+++ b/demos/3d/platformer/coin.gd
@@ -1,11 +1,11 @@
extends Area
-# member variables
+# Member variables
var taken = false
func _on_coin_body_enter(body):
if (not taken and body extends preload("res://player.gd")):
get_node("anim").play("take")
- taken=true
+ taken = true
diff --git a/demos/3d/platformer/enemy.gd b/demos/3d/platformer/enemy.gd
index 61671c7bd3..55c79e4858 100644
--- a/demos/3d/platformer/enemy.gd
+++ b/demos/3d/platformer/enemy.gd
@@ -1,7 +1,7 @@
extends RigidBody
-# member variables
+# Member variables
const STATE_WALKING = 0
const STATE_DYING = 1
@@ -20,9 +20,9 @@ func _integrate_forces(state):
var lv = state.get_linear_velocity()
var g = state.get_total_gravity()
- lv += g*delta # apply gravity
+ lv += g*delta # Apply gravity
var up = -g.normalized()
-
+
if (dying):
state.set_linear_velocity(lv)
return
diff --git a/demos/3d/platformer/follow_camera.gd b/demos/3d/platformer/follow_camera.gd
index 3d18327df0..d0d531b9a5 100644
--- a/demos/3d/platformer/follow_camera.gd
+++ b/demos/3d/platformer/follow_camera.gd
@@ -1,95 +1,80 @@
extends Camera
-# member variables here, example:
-# var a=2
-# var b="textvar"
-
-var collision_exception=[]
-export var min_distance=0.5
-export var max_distance=4.0
-export var angle_v_adjust=0.0
-export var autoturn_ray_aperture=25
-export var autoturn_speed=50
+# Member variables
+var collision_exception = []
+export var min_distance = 0.5
+export var max_distance = 4.0
+export var angle_v_adjust = 0.0
+export var autoturn_ray_aperture = 25
+export var autoturn_speed = 50
var max_height = 2.0
var min_height = 0
func _fixed_process(dt):
- var target = get_parent().get_global_transform().origin
+ var target = get_parent().get_global_transform().origin
var pos = get_global_transform().origin
- var up = Vector3(0,1,0)
+ var up = Vector3(0, 1, 0)
var delta = pos - target
- #regular delta follow
-
- #check ranges
+ # Regular delta follow
+ # Check ranges
if (delta.length() < min_distance):
- delta = delta.normalized() * min_distance
+ delta = delta.normalized()*min_distance
elif (delta.length() > max_distance):
- delta = delta.normalized() * max_distance
+ delta = delta.normalized()*max_distance
- #check upper and lower height
- if ( delta.y > max_height):
+ # Check upper and lower height
+ if (delta.y > max_height):
delta.y = max_height
- if ( delta.y < min_height):
+ if (delta.y < min_height):
delta.y = min_height
- #check autoturn
-
- var ds = PhysicsServer.space_get_direct_state( get_world().get_space() )
-
+ # Check autoturn
+ var ds = PhysicsServer.space_get_direct_state(get_world().get_space())
- var col_left = ds.intersect_ray(target,target+Matrix3(up,deg2rad(autoturn_ray_aperture)).xform(delta),collision_exception)
- var col = ds.intersect_ray(target,target+delta,collision_exception)
- var col_right = ds.intersect_ray(target,target+Matrix3(up,deg2rad(-autoturn_ray_aperture)).xform(delta),collision_exception)
+ var col_left = ds.intersect_ray(target, target + Matrix3(up, deg2rad(autoturn_ray_aperture)).xform(delta), collision_exception)
+ var col = ds.intersect_ray(target, target + delta, collision_exception)
+ var col_right = ds.intersect_ray(target, target + Matrix3(up, deg2rad(-autoturn_ray_aperture)).xform(delta), collision_exception)
if (!col.empty()):
- #if main ray was occluded, get camera closer, this is the worst case scenario
+ # If main ray was occluded, get camera closer, this is the worst case scenario
delta = col.position - target
elif (!col_left.empty() and col_right.empty()):
- #if only left ray is occluded, turn the camera around to the right
- delta = Matrix3(up,deg2rad(-dt*autoturn_speed)).xform(delta)
+ # If only left ray is occluded, turn the camera around to the right
+ delta = Matrix3(up, deg2rad(-dt*autoturn_speed)).xform(delta)
elif (col_left.empty() and !col_right.empty()):
- #if only right ray is occluded, turn the camera around to the left
- delta = Matrix3(up,deg2rad(dt*autoturn_speed)).xform(delta)
+ # If only right ray is occluded, turn the camera around to the left
+ delta = Matrix3(up, deg2rad(dt*autoturn_speed)).xform(delta)
else:
- #do nothing otherwise, left and right are occluded but center is not, so do not autoturn
+ # Do nothing otherwise, left and right are occluded but center is not, so do not autoturn
pass
- #apply lookat
- if (delta==Vector3()):
- delta = (pos - target).normalized() * 0.0001
+ # Apply lookat
+ if (delta == Vector3()):
+ delta = (pos - target).normalized()*0.0001
pos = target + delta
- look_at_from_pos(pos,target,up)
+ look_at_from_pos(pos, target, up)
- #turn a little up or down
+ # Turn a little up or down
var t = get_transform()
- t.basis = Matrix3(t.basis[0],deg2rad(angle_v_adjust)) * t.basis
+ t.basis = Matrix3(t.basis[0], deg2rad(angle_v_adjust))*t.basis
set_transform(t)
-
-
-func _ready():
-#find collision exceptions for ray
+func _ready():
+ # Find collision exceptions for ray
var node = self
while(node):
if (node extends RigidBody):
collision_exception.append(node.get_rid())
break
else:
- node=node.get_parent()
- # Initalization here
+ node = node.get_parent()
set_fixed_process(true)
- #this detaches the camera transform from the parent spatial node
+ # This detaches the camera transform from the parent spatial node
set_as_toplevel(true)
-
-
-
-
-
-
diff --git a/demos/3d/platformer/player.gd b/demos/3d/platformer/player.gd
index f299f885ed..4cac1817e4 100644
--- a/demos/3d/platformer/player.gd
+++ b/demos/3d/platformer/player.gd
@@ -1,7 +1,7 @@
extends RigidBody
-# member variables
+# Member variables
const ANIM_FLOOR = 0
const ANIM_AIR_UP = 1
const ANIM_AIR_DOWN = 2
@@ -14,14 +14,14 @@ const CHAR_SCALE = Vector3(0.3, 0.3, 0.3)
var facing_dir = Vector3(1, 0, 0)
var movement_dir = Vector3()
-var jumping=false
+var jumping = false
var turn_speed = 40
var keep_jump_inertia = true
var air_idle_deaccel = false
var accel = 19.0
var deaccel = 14.0
-var sharp_turn_threshhold = 140
+var sharp_turn_threshold = 140
var max_speed = 3.1
var on_floor = false
@@ -34,7 +34,7 @@ var shoot_blend = 0
func adjust_facing(p_facing, p_target, p_step, p_adjust_rate, current_gn):
- var n = p_target # normal
+ var n = p_target # Normal
var t = n.cross(current_gn).normalized()
var x = n.dot(p_facing)
@@ -42,7 +42,7 @@ func adjust_facing(p_facing, p_target, p_step, p_adjust_rate, current_gn):
var ang = atan2(y,x)
- if (abs(ang) < 0.001): # too small
+ if (abs(ang) < 0.001): # Too small
return p_facing
var s = sign(ang)
@@ -59,22 +59,22 @@ func adjust_facing(p_facing, p_target, p_step, p_adjust_rate, current_gn):
func _integrate_forces(state):
- var lv = state.get_linear_velocity() # linear velocity
+ var lv = state.get_linear_velocity() # Linear velocity
var g = state.get_total_gravity()
var delta = state.get_step()
# var d = 1.0 - delta*state.get_total_density()
# if (d < 0):
# d = 0
- lv += g*delta # apply gravity
+ lv += g*delta # Apply gravity
var anim = ANIM_FLOOR
var up = -g.normalized() # (up is against gravity)
- var vv = up.dot(lv) # vertical velocity
- var hv = lv - up*vv # horizontal velocity
+ var vv = up.dot(lv) # Vertical velocity
+ var hv = lv - up*vv # Horizontal velocity
- var hdir = hv.normalized() # horizontal direction
- var hspeed = hv.length() # horizontal speed
+ var hdir = hv.normalized() # Horizontal direction
+ var hspeed = hv.length() # Horizontal speed
var floor_velocity
var onfloor = false
@@ -90,7 +90,7 @@ func _integrate_forces(state):
floor_velocity = state.get_contact_collider_velocity_at_pos(i)
break
- var dir = Vector3() # where does the player intend to walk to
+ var dir = Vector3() # Where does the player intend to walk to
var cam_xform = get_node("target/camera").get_global_transform()
if (Input.is_action_pressed("move_forward")):
@@ -108,7 +108,7 @@ func _integrate_forces(state):
var target_dir = (dir - up*dir.dot(up)).normalized()
if (onfloor):
- var sharp_turn = hspeed > 0.1 and rad2deg(acos(target_dir.dot(hdir))) > sharp_turn_threshhold
+ var sharp_turn = hspeed > 0.1 and rad2deg(acos(target_dir.dot(hdir))) > sharp_turn_threshold
if (dir.length() > 0.1 and !sharp_turn):
if (hspeed > 0.001):
@@ -130,7 +130,7 @@ func _integrate_forces(state):
hv = hdir*hspeed
- var mesh_xform = get_node("Armature").get_transform()
+ var mesh_xform = get_node("Armature").get_transform()
var facing_mesh = -mesh_xform.basis[0].normalized()
facing_mesh = (facing_mesh - up*facing_mesh.dot(up)).normalized()
facing_mesh = adjust_facing(facing_mesh, target_dir, delta, 1.0/hspeed*turn_speed, up)
@@ -171,7 +171,7 @@ func _integrate_forces(state):
#lv += floor_velocity
last_floor_velocity = floor_velocity
else:
- if (on_floor) :
+ if (on_floor):
#if (keep_jump_inertia):
# lv += last_floor_velocity
pass
@@ -180,7 +180,7 @@ func _integrate_forces(state):
movement_dir = lv
on_floor = onfloor
-
+
state.set_linear_velocity(lv)
if (shoot_blend > 0):
@@ -194,7 +194,7 @@ func _integrate_forces(state):
bullet.set_transform(get_node("Armature/bullet").get_global_transform().orthonormalized())
get_parent().add_child(bullet)
bullet.set_linear_velocity(get_node("Armature/bullet").get_global_transform().basis[2].normalized()*20)
- PS.body_add_collision_exception(bullet.get_rid(), get_rid()) # add it to bullet
+ PS.body_add_collision_exception(bullet.get_rid(), get_rid()) # Add it to bullet
get_node("sfx").play("shoot")
prev_shoot = shoot_attempt
diff --git a/demos/3d/truck_town/car_select.gd b/demos/3d/truck_town/car_select.gd
index 62383a8b9a..4efcf63426 100644
--- a/demos/3d/truck_town/car_select.gd
+++ b/demos/3d/truck_town/car_select.gd
@@ -1,7 +1,7 @@
extends Control
-# member variables
+# Member variables
var town = null
diff --git a/demos/3d/truck_town/follow_camera.gd b/demos/3d/truck_town/follow_camera.gd
index 5e6324db73..7c6a0a2ba6 100644
--- a/demos/3d/truck_town/follow_camera.gd
+++ b/demos/3d/truck_town/follow_camera.gd
@@ -1,7 +1,7 @@
extends Camera
-# member variables
+# Member variables
var collision_exception = []
export var min_distance = 0.5
export var max_distance = 4.0
@@ -19,15 +19,15 @@ func _fixed_process(dt):
var delta = pos - target
- # regular delta follow
+ # Regular delta follow
- # check ranges
+ # Check ranges
if (delta.length() < min_distance):
delta = delta.normalized()*min_distance
elif (delta.length() > max_distance):
delta = delta.normalized()*max_distance
- # check upper and lower height
+ # Check upper and lower height
if ( delta.y > max_height):
delta.y = max_height
if ( delta.y < min_height):
@@ -37,14 +37,14 @@ func _fixed_process(dt):
look_at_from_pos(pos, target, up)
- # turn a little up or down
+ # Turn a little up or down
var t = get_transform()
t.basis = Matrix3(t.basis[0], deg2rad(angle_v_adjust))*t.basis
set_transform(t)
func _ready():
- # find collision exceptions for ray
+ # Find collision exceptions for ray
var node = self
while(node):
if (node extends RigidBody):
@@ -53,5 +53,5 @@ func _ready():
else:
node = node.get_parent()
set_fixed_process(true)
- # this detaches the camera transform from the parent spatial node
+ # This detaches the camera transform from the parent spatial node
set_as_toplevel(true)
diff --git a/demos/3d/truck_town/vehicle.gd b/demos/3d/truck_town/vehicle.gd
index 1c9bd2e891..22c5b7f0d4 100644
--- a/demos/3d/truck_town/vehicle.gd
+++ b/demos/3d/truck_town/vehicle.gd
@@ -1,7 +1,7 @@
extends VehicleBody
-# member variables
+# Member variables
const STEER_SPEED = 1
const STEER_LIMIT = 0.4
diff --git a/demos/gui/drag_and_drop/drag_drop_script.gd b/demos/gui/drag_and_drop/drag_drop_script.gd
index 7bcaf1a35e..719c42fe8f 100644
--- a/demos/gui/drag_and_drop/drag_drop_script.gd
+++ b/demos/gui/drag_and_drop/drag_drop_script.gd
@@ -3,12 +3,12 @@ extends ColorPickerButton
func get_drag_data(pos):
- # use another colorpicker as drag preview
+ # Use another colorpicker as drag preview
var cpb = ColorPickerButton.new()
cpb.set_color(get_color())
cpb.set_size(Vector2(50, 50))
set_drag_preview(cpb)
- # return color as drag data
+ # Return color as drag data
return get_color()
diff --git a/demos/gui/input_mapping/controls.gd b/demos/gui/input_mapping/controls.gd
index 7420053ef1..3cee6e6871 100644
--- a/demos/gui/input_mapping/controls.gd
+++ b/demos/gui/input_mapping/controls.gd
@@ -1,3 +1,6 @@
+
+extends Control
+
# Note for the reader:
#
# This demo conveniently uses the same names for actions and for the container nodes
@@ -9,9 +12,7 @@
# action and the node, e.g.:
# button.connect("pressed", self, "wait_for_input", [ button, action ])
-extends Control
-
-# member variables
+# Member variables
var player_actions = [ "move_up", "move_down", "move_left", "move_right", "jump" ]
var action # To register the action the UI is currently handling
var button # Button node corresponding to the above action
diff --git a/demos/gui/translation/main.gd b/demos/gui/translation/main.gd
index 9b188cd588..c3e788f82b 100644
--- a/demos/gui/translation/main.gd
+++ b/demos/gui/translation/main.gd
@@ -10,7 +10,7 @@ func _goto_scene():
func _on_system_pressed():
- # will autodetect based on system, then fall back
+ # Will autodetect based on system, then fall back
# to english if not found
_goto_scene()
diff --git a/demos/misc/autoload/global.gd b/demos/misc/autoload/global.gd
index 126cbc0ab7..e094ab9784 100644
--- a/demos/misc/autoload/global.gd
+++ b/demos/misc/autoload/global.gd
@@ -1,6 +1,6 @@
extends Node
-# member variables
+# Member variables
var current_scene = null
@@ -34,7 +34,7 @@ func _deferred_goto_scene(path):
func _ready():
# Get the current scene, the first time.
- # it is always the last child of root,
+ # It is always the last child of root,
# after the autoloaded nodes.
var root = get_tree().get_root()
diff --git a/demos/misc/autoload/scene_a.gd b/demos/misc/autoload/scene_a.gd
index b95ce7dc6e..f9c39887b0 100644
--- a/demos/misc/autoload/scene_a.gd
+++ b/demos/misc/autoload/scene_a.gd
@@ -1,7 +1,7 @@
extends Panel
-# member variables here, example:
+# Member variables here, example:
# var a=2
# var b="textvar"
@@ -13,4 +13,4 @@ func _ready():
func _on_goto_scene_pressed():
get_node("/root/global").goto_scene("res://scene_b.scn")
- pass # replace with function body
+ pass # Replace with function body
diff --git a/demos/misc/autoload/scene_b.gd b/demos/misc/autoload/scene_b.gd
index 599058848b..fdf2287a04 100644
--- a/demos/misc/autoload/scene_b.gd
+++ b/demos/misc/autoload/scene_b.gd
@@ -1,7 +1,7 @@
extends Panel
-# member variables here, example:
+# Member variables here, example:
# var a=2
# var b="textvar"
@@ -13,4 +13,4 @@ func _ready():
func _on_goto_scene_pressed():
get_node("/root/global").goto_scene("res://scene_a.scn")
- pass # replace with function body
+ pass # Replace with function body
diff --git a/demos/misc/joysticks/joysticks.gd b/demos/misc/joysticks/joysticks.gd
index dc9166e49e..7add88573d 100644
--- a/demos/misc/joysticks/joysticks.gd
+++ b/demos/misc/joysticks/joysticks.gd
@@ -8,7 +8,7 @@ extends Node2D
#
# Licensed under the MIT license
-# member variables
+# Member variables
var joy_num
var cur_joy
var axis_value
@@ -16,21 +16,21 @@ var btn_state
func _input(event):
- # get the joystick device number from the spinbox
+ # Get the joystick device number from the spinbox
joy_num = get_node("joy_num").get_value()
- # display the name of the joystick if we haven't already
+ # Display the name of the joystick if we haven't already
if joy_num != cur_joy:
cur_joy = joy_num
get_node("joy_name").set_text(Input.get_joy_name(joy_num))
- # loop through the axes and show their current values
+ # Loop through the axes and show their current values
for axis in range(0, 8):
axis_value = Input.get_joy_axis(joy_num, axis)
get_node("axis_prog" + str(axis)).set_value(100*axis_value)
get_node("axis_val" + str(axis)).set_text(str(axis_value))
- # loop through the buttons and highlight the ones that are pressed
+ # Loop through the buttons and highlight the ones that are pressed
for btn in range(0, 17):
btn_state = 1
if (Input.is_joy_button_pressed(joy_num, btn)):
diff --git a/demos/misc/regex/regex.gd b/demos/misc/regex/regex.gd
index 4921f4ff2e..98e5ca8828 100644
--- a/demos/misc/regex/regex.gd
+++ b/demos/misc/regex/regex.gd
@@ -1,7 +1,7 @@
extends VBoxContainer
-# member variables
+# Member variables
var regex = RegEx.new()
diff --git a/demos/misc/scene_changer/scene_a.gd b/demos/misc/scene_changer/scene_a.gd
index e27c48cf11..0e80395e84 100644
--- a/demos/misc/scene_changer/scene_a.gd
+++ b/demos/misc/scene_changer/scene_a.gd
@@ -1,7 +1,7 @@
extends Panel
-# member variables here, example:
+# Member variables here, example:
# var a=2
# var b="textvar"
@@ -13,4 +13,4 @@ func _ready():
func _on_goto_scene_pressed():
get_tree().change_scene("res://scene_b.scn")
- pass # replace with function body
+ pass # Replace with function body
diff --git a/demos/misc/scene_changer/scene_b.gd b/demos/misc/scene_changer/scene_b.gd
index b785ada45c..9ed13cf26b 100644
--- a/demos/misc/scene_changer/scene_b.gd
+++ b/demos/misc/scene_changer/scene_b.gd
@@ -1,7 +1,7 @@
extends Panel
-# member variables here, example:
+# Member variables here, example:
# var a=2
# var b="textvar"
@@ -13,4 +13,4 @@ func _ready():
func _on_goto_scene_pressed():
get_tree().change_scene("res://scene_a.scn")
- pass # replace with function body
+ pass # Replace with function body
diff --git a/demos/misc/threads/thread.gd b/demos/misc/threads/thread.gd
index fbfd68af2b..1ef67e403c 100644
--- a/demos/misc/threads/thread.gd
+++ b/demos/misc/threads/thread.gd
@@ -1,31 +1,31 @@
extends Node2D
-# member variables
+# Member variables
var thread = Thread.new()
-# this function runs in a thread!
-# threads always take one userdata argument
+# This function runs in a thread!
+# Threads always take one userdata argument
func _bg_load(path):
print("THREAD FUNC!")
- # load the resource
+ # Load the resource
var tex = ResourceLoader.load(path)
- # call _bg_load_done on main thread
+ # Call _bg_load_done on main thread
call_deferred("_bg_load_done")
return tex # return it
func _bg_load_done():
- # wait for the thread to complete, get the returned value
+ # Wait for the thread to complete, get the returned value
var tex = thread.wait_to_finish()
- # set to the sprite
+ # Set to the sprite
get_node("sprite").set_texture(tex)
func _on_load_pressed():
if (thread.is_active()):
- # already working
+ # Already working
return
print("START THREAD!")
thread.start(self, "_bg_load", "res://mona.png")
diff --git a/demos/misc/tween/main.gd b/demos/misc/tween/main.gd
index 4d37c18ba9..512271311e 100644
--- a/demos/misc/tween/main.gd
+++ b/demos/misc/tween/main.gd
@@ -1,7 +1,7 @@
extends Control
-# member variables
+# Member variables
var trans = ["linear", "sine", "quint", "quart", "quad", "expo", "elastic", "cubic", "circ", "bounce", "back"]
var eases = ["in", "out", "in_out", "out_in"]
var modes = ["move", "color", "scale", "rotate", "callback", "follow", "repeat", "pause"]
diff --git a/demos/misc/udp_chat/chat.gd b/demos/misc/udp_chat/chat.gd
index a2d52bf126..71286895f4 100644
--- a/demos/misc/udp_chat/chat.gd
+++ b/demos/misc/udp_chat/chat.gd
@@ -5,7 +5,7 @@ extends Panel
# (UDP can lose packets and you won't normally find out, so don't do a chat this way)
# This is just a demo that shows how to use the UDP class.
-# member variables
+# Member variables
var udp = PacketPeerUDP.new()
diff --git a/demos/misc/window_management/control.gd b/demos/misc/window_management/control.gd
index 881dbdc798..cd8e0e185b 100644
--- a/demos/misc/window_management/control.gd
+++ b/demos/misc/window_management/control.gd
@@ -1,7 +1,7 @@
extends Control
-# member variables
+# Member variables
var mousepos
diff --git a/demos/misc/window_management/observer/observer.gd b/demos/misc/window_management/observer/observer.gd
index c1878bca43..f100811859 100644
--- a/demos/misc/window_management/observer/observer.gd
+++ b/demos/misc/window_management/observer/observer.gd
@@ -1,7 +1,7 @@
extends Spatial
-# member variables
+# Member variables
var r_pos = Vector2()
var state
@@ -29,7 +29,7 @@ func _fixed_process(delta):
if(Input.get_mouse_mode() != Input.MOUSE_MODE_CAPTURED):
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
- var dir = Vector3()
+ var dir = Vector3()
var cam = get_global_transform()
var org = get_translation()
diff --git a/demos/viewport/2d_in_3d/pong.gd b/demos/viewport/2d_in_3d/pong.gd
index 113c1cd44e..bf93c63bf2 100644
--- a/demos/viewport/2d_in_3d/pong.gd
+++ b/demos/viewport/2d_in_3d/pong.gd
@@ -1,45 +1,45 @@
extends Node2D
-# member variables
+# Member variables
const INITIAL_BALL_SPEED = 80
var ball_speed = INITIAL_BALL_SPEED
-var screen_size = Vector2(640,400)
-# default ball direction
-var direction = Vector2(-1,0)
-var pad_size = Vector2(8,32)
+var screen_size = Vector2(640, 400)
+# Default ball direction
+var direction = Vector2(-1, 0)
+var pad_size = Vector2(8, 32)
const PAD_SPEED = 150
func _process(delta):
- # get ball position and pad rectangles
+ # Get ball position and pad rectangles
var ball_pos = get_node("ball").get_pos()
var left_rect = Rect2(get_node("left").get_pos() - pad_size*0.5, pad_size)
var right_rect = Rect2(get_node("right").get_pos() - pad_size*0.5, pad_size)
- # integrate new ball postion
+ # Integrate new ball postion
ball_pos += direction*ball_speed*delta
- # flip when touching roof or floor
+ # Flip when touching roof or floor
if ((ball_pos.y < 0 and direction.y < 0) or (ball_pos.y > screen_size.y and direction.y > 0)):
direction.y = -direction.y
- # flip, change direction and increase speed when touching pads
+ # Flip, change direction and increase speed when touching pads
if ((left_rect.has_point(ball_pos) and direction.x < 0) or (right_rect.has_point(ball_pos) and direction.x > 0)):
direction.x = -direction.x
ball_speed *= 1.1
direction.y = randf()*2.0 - 1
direction = direction.normalized()
- # check gameover
+ # Check gameover
if (ball_pos.x < 0 or ball_pos.x > screen_size.x):
ball_pos = screen_size*0.5
ball_speed = INITIAL_BALL_SPEED
- direction = Vector2(-1,0)
+ direction = Vector2(-1, 0)
get_node("ball").set_pos(ball_pos)
- # move left pad
+ # Move left pad
var left_pos = get_node("left").get_pos()
if (left_pos.y > 0 and Input.is_action_pressed("left_move_up")):
@@ -49,7 +49,7 @@ func _process(delta):
get_node("left").set_pos(left_pos)
- # move right pad
+ # Move right pad
var right_pos = get_node("right").get_pos()
if (right_pos.y > 0 and Input.is_action_pressed("right_move_up")):
@@ -62,6 +62,6 @@ func _process(delta):
func _ready():
# Initalization here
- screen_size = get_viewport_rect().size # get actual size
+ screen_size = get_viewport_rect().size # Get actual size
pad_size = get_node("left").get_texture().get_size()
set_process(true)
diff --git a/demos/viewport/gui_in_3d/gui_3d.gd b/demos/viewport/gui_in_3d/gui_3d.gd
index 8b9e352682..c640b133d3 100644
--- a/demos/viewport/gui_in_3d/gui_3d.gd
+++ b/demos/viewport/gui_in_3d/gui_3d.gd
@@ -1,26 +1,26 @@
extends Spatial
-# member variables
+# Member variables
var prev_pos = null
func _input(event):
- # all other (non-mouse) events
+ # All other (non-mouse) events
if (not event.type in [InputEvent.MOUSE_BUTTON, InputEvent.MOUSE_MOTION, InputEvent.SCREEN_DRAG, InputEvent.SCREEN_TOUCH]):
get_node("viewport").input(event)
-# mouse events for area
+# Mouse events for Area
func _on_area_input_event(camera, event, click_pos, click_normal, shape_idx):
- # use click pos (click in 3d space, convert to area space)
+ # Use click pos (click in 3d space, convert to area space)
var pos = get_node("area").get_global_transform().affine_inverse()*click_pos
- # convert to 2D
+ # Convert to 2D
pos = Vector2(pos.x, pos.y)
- # convert to viewport coordinate system
+ # Convert to viewport coordinate system
pos.x = (pos.x + 1.5)*100
pos.y = (-pos.y + 0.75)*100
- # set to event
+ # Set to event
event.pos = pos
event.global_pos = pos
if (prev_pos == null):
@@ -28,7 +28,7 @@ func _on_area_input_event(camera, event, click_pos, click_normal, shape_idx):
if (event.type == InputEvent.MOUSE_MOTION):
event.relative_pos = pos - prev_pos
prev_pos = pos
- # sned the event to the viewport
+ # Send the event to the viewport
get_node("viewport").input(event)
diff --git a/demos/viewport/screen_capture/screen_capture.gd b/demos/viewport/screen_capture/screen_capture.gd
index 393efb60b6..9867d95452 100644
--- a/demos/viewport/screen_capture/screen_capture.gd
+++ b/demos/viewport/screen_capture/screen_capture.gd
@@ -4,13 +4,13 @@ extends Control
func _on_button_pressed():
get_viewport().queue_screen_capture()
- # let two frames pass to make sure the screen was captured
- yield(get_tree(),"idle_frame")
- yield(get_tree(),"idle_frame")
- # retrieve the captured image
+ # Let two frames pass to make sure the screen was captured
+ yield(get_tree(), "idle_frame")
+ yield(get_tree(), "idle_frame")
+ # Retrieve the captured image
var img = get_viewport().get_screen_capture()
- # create a texture for it
+ # Create a texture for it
var tex = ImageTexture.new()
tex.create_from_image(img)
- # set it to the capture node
+ # Set it to the capture node
get_node("capture").set_texture(tex)