Browse Source

Use upper-cased first letter at the start of comment sentences

Rémi Verschelde 9 years ago
parent
commit
f76b29f30d

+ 5 - 5
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

+ 7 - 7
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)

+ 2 - 2
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):

+ 2 - 2
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):

+ 2 - 2
3d/platformer/bullet.gd

@@ -1,5 +1,5 @@
 
 extends RigidBody
 
-# member variables
-var disabled=false
+# Member variables
+var disabled = false

+ 2 - 2
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

+ 3 - 3
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

+ 37 - 52
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)
-
-	
-	
-
-
-

+ 17 - 17
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

+ 1 - 1
3d/truck_town/car_select.gd

@@ -1,7 +1,7 @@
 
 extends Control
 
-# member variables
+# Member variables
 var town = null
 
 

+ 7 - 7
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)

+ 1 - 1
3d/truck_town/vehicle.gd

@@ -1,7 +1,7 @@
 
 extends VehicleBody
 
-# member variables
+# Member variables
 const STEER_SPEED = 1
 const STEER_LIMIT = 0.4
 

+ 2 - 2
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()
 
 

+ 4 - 3
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

+ 1 - 1
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()
 

+ 2 - 2
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()

+ 2 - 2
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

+ 2 - 2
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

+ 5 - 5
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)):

+ 1 - 1
misc/regex/regex.gd

@@ -1,7 +1,7 @@
 
 extends VBoxContainer
 
-# member variables
+# Member variables
 var regex = RegEx.new()
 
 

+ 2 - 2
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

+ 2 - 2
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

+ 8 - 8
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")

+ 1 - 1
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"]

+ 1 - 1
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()
 
 

+ 1 - 1
misc/window_management/control.gd

@@ -1,7 +1,7 @@
 
 extends Control
 
-# member variables
+# Member variables
 var mousepos
 
 

+ 2 - 2
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()
 	

+ 14 - 14
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)

+ 8 - 8
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)
 
 

+ 6 - 6
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)