diff --git a/2d/dodge_the_creeps/HUD.gd b/2d/dodge_the_creeps/HUD.gd index e817a4bc..cb6c7e31 100644 --- a/2d/dodge_the_creeps/HUD.gd +++ b/2d/dodge_the_creeps/HUD.gd @@ -13,7 +13,7 @@ func show_game_over(): yield($MessageTimer, "timeout") $MessageLabel.text = "Dodge the\nCreeps" $MessageLabel.show() - yield(get_tree().create_timer(1), 'timeout') + yield(get_tree().create_timer(1), "timeout") $StartButton.show() diff --git a/2d/dodge_the_creeps/Main.gd b/2d/dodge_the_creeps/Main.gd index 7695ef5f..e13c2d33 100644 --- a/2d/dodge_the_creeps/Main.gd +++ b/2d/dodge_the_creeps/Main.gd @@ -1,6 +1,6 @@ extends Node -export (PackedScene) var Mob +export(PackedScene) var Mob var score func _ready(): @@ -28,9 +28,9 @@ func _on_MobTimer_timeout(): $MobPath/MobSpawnLocation.offset = randi() var mob = Mob.instance() add_child(mob) - var direction = $MobPath/MobSpawnLocation.rotation + PI / 2 + var direction = $MobPath/MobSpawnLocation.rotation + TAU / 4 mob.position = $MobPath/MobSpawnLocation.position - direction += rand_range(-PI / 4, PI / 4) + direction += rand_range(-TAU / 8, TAU / 8) mob.rotation = direction mob.linear_velocity = Vector2(rand_range(mob.min_speed, mob.max_speed), 0).rotated(direction) # warning-ignore:return_value_discarded diff --git a/2d/finite_state_machine/debug/states_stack_displayer.gd b/2d/finite_state_machine/debug/states_stack_displayer.gd index 7c6ad245..79f30835 100644 --- a/2d/finite_state_machine/debug/states_stack_displayer.gd +++ b/2d/finite_state_machine/debug/states_stack_displayer.gd @@ -7,8 +7,8 @@ func _process(_delta): var numbers = "" var index = 0 for state in fsm_node.states_stack: - states_names += state.get_name() + '\n' - numbers += str(index) + '\n' + states_names += state.get_name() + "\n" + numbers += str(index) + "\n" index += 1 $States.text = states_names $Numbers.text = numbers diff --git a/2d/finite_state_machine/player/bullet/bullet.gd b/2d/finite_state_machine/player/bullet/bullet.gd index bce78634..573816f3 100644 --- a/2d/finite_state_machine/player/bullet/bullet.gd +++ b/2d/finite_state_machine/player/bullet/bullet.gd @@ -3,12 +3,14 @@ extends KinematicBody2D var direction = Vector2() export(float) var speed = 1000.0 +onready var root = get_tree().root + func _ready(): set_as_toplevel(true) func _physics_process(delta): - if is_outside_view_bounds(): + if not root.get_visible_rect().has_point(position): queue_free() var motion = direction * speed * delta @@ -17,10 +19,5 @@ func _physics_process(delta): queue_free() -func is_outside_view_bounds(): - return position.x > OS.get_screen_size().x or position.x < 0.0 \ - or position.y > OS.get_screen_size().y or position.y < 0.0 - - func _draw(): draw_circle(Vector2(), $CollisionShape2D.shape.radius, Color.white) diff --git a/2d/finite_state_machine/player/player_state_machine.gd b/2d/finite_state_machine/player/player_state_machine.gd index e3267677..261193ac 100644 --- a/2d/finite_state_machine/player/player_state_machine.gd +++ b/2d/finite_state_machine/player/player_state_machine.gd @@ -1,12 +1,18 @@ extends "res://state_machine/state_machine.gd" +onready var idle = $Idle +onready var move = $Move +onready var jump = $Jump +onready var stagger = $Stagger +onready var attack = $Attack + func _ready(): states_map = { - "idle": $Idle, - "move": $Move, - "jump": $Jump, - "stagger": $Stagger, - "attack": $Attack, + "idle": idle, + "move": move, + "jump": jump, + "stagger": stagger, + "attack": attack, } @@ -16,8 +22,8 @@ func _change_state(state_name): return if state_name in ["stagger", "jump", "attack"]: states_stack.push_front(states_map[state_name]) - if state_name == "jump" and current_state == $Move: - $Jump.initialize($Move.speed, $Move.velocity) + if state_name == "jump" and current_state == move: + jump.initialize(move.speed, move.velocity) ._change_state(state_name) @@ -25,7 +31,7 @@ func _unhandled_input(event): # Here we only handle input that can interrupt states, attacking in this case, # otherwise we let the state node handle it. if event.is_action_pressed("attack"): - if current_state in [$Attack, $Stagger]: + if current_state in [attack, stagger]: return _change_state("attack") return diff --git a/2d/finite_state_machine/player/states/motion/in_air/jump.gd b/2d/finite_state_machine/player/states/motion/in_air/jump.gd index da3be9c3..22cdd39c 100644 --- a/2d/finite_state_machine/player/states/motion/in_air/jump.gd +++ b/2d/finite_state_machine/player/states/motion/in_air/jump.gd @@ -22,6 +22,7 @@ func initialize(speed, velocity): max_horizontal_speed = speed if speed > 0.0 else base_max_horizontal_speed enter_velocity = velocity + func enter(): var input_direction = get_input_direction() update_look_direction(input_direction) @@ -31,6 +32,7 @@ func enter(): owner.get_node("AnimationPlayer").play("idle") + func update(delta): var input_direction = get_input_direction() update_look_direction(input_direction) @@ -40,6 +42,7 @@ func update(delta): if height <= 0.0: emit_signal("finished", "previous") + func move_horizontally(delta, direction): if direction: horizontal_speed += air_acceleration * delta @@ -53,6 +56,7 @@ func move_horizontally(delta, direction): owner.move_and_slide(horizontal_velocity) + func animate_jump_height(delta): vertical_speed -= gravity * delta height += vertical_speed * delta diff --git a/2d/finite_state_machine/player/states/motion/motion.gd b/2d/finite_state_machine/player/states/motion/motion.gd index 943cd2b7..aaf9261b 100644 --- a/2d/finite_state_machine/player/states/motion/motion.gd +++ b/2d/finite_state_machine/player/states/motion/motion.gd @@ -7,9 +7,10 @@ func handle_input(event): func get_input_direction(): - var input_direction = Vector2() - input_direction.x = Input.get_action_strength("move_right") - Input.get_action_strength("move_left") - input_direction.y = Input.get_action_strength("move_down") - Input.get_action_strength("move_up") + var input_direction = Vector2( + Input.get_action_strength("move_right") - Input.get_action_strength("move_left"), + Input.get_action_strength("move_down") - Input.get_action_strength("move_up") + ) return input_direction diff --git a/2d/finite_state_machine/state_machine/state_machine.gd b/2d/finite_state_machine/state_machine/state_machine.gd index dc09581e..fec9c423 100644 --- a/2d/finite_state_machine/state_machine/state_machine.gd +++ b/2d/finite_state_machine/state_machine/state_machine.gd @@ -21,7 +21,9 @@ func _ready(): if not start_state: start_state = get_child(0).get_path() for child in get_children(): - child.connect("finished", self, "_change_state") + var err = child.connect("finished", self, "_change_state") + if err: + printerr(err) initialize(start_state) diff --git a/2d/gd_paint/PaintControl.gd b/2d/gd_paint/paint_control.gd similarity index 98% rename from 2d/gd_paint/PaintControl.gd rename to 2d/gd_paint/paint_control.gd index 2372112f..b97e5d02 100644 --- a/2d/gd_paint/PaintControl.gd +++ b/2d/gd_paint/paint_control.gd @@ -232,11 +232,9 @@ func _draw(): draw_circle(brush.brush_pos, brush.brush_shape_circle_radius, brush.brush_color) - func save_picture(path): - # Wait a couple frames so the save dialog isn't in the way. - yield (get_tree(), "idle_frame") - yield (get_tree(), "idle_frame") + # Wait until the frame has finished before getting the texture. + yield(VisualServer, "frame_post_draw") # Get the viewport image. var img = get_viewport().get_texture().get_data() diff --git a/2d/gd_paint/Paint_root.tscn b/2d/gd_paint/paint_root.tscn similarity index 96% rename from 2d/gd_paint/Paint_root.tscn rename to 2d/gd_paint/paint_root.tscn index d2ecdabe..23a9d85e 100644 --- a/2d/gd_paint/Paint_root.tscn +++ b/2d/gd_paint/paint_root.tscn @@ -1,8 +1,8 @@ [gd_scene load_steps=5 format=2] -[ext_resource path="res://PaintControl.gd" type="Script" id=1] -[ext_resource path="res://ToolsPanel.gd" type="Script" id=2] -[ext_resource path="res://PaintTools.png" type="Texture" id=3] +[ext_resource path="res://paint_control.gd" type="Script" id=1] +[ext_resource path="res://tools_panel.gd" type="Script" id=2] +[ext_resource path="res://paint_tools.png" type="Texture" id=3] [sub_resource type="StyleBoxFlat" id=1] bg_color = Color( 1, 1, 1, 1 ) diff --git a/2d/gd_paint/PaintTools.png b/2d/gd_paint/paint_tools.png similarity index 100% rename from 2d/gd_paint/PaintTools.png rename to 2d/gd_paint/paint_tools.png diff --git a/2d/gd_paint/PaintTools.png.import b/2d/gd_paint/paint_tools.png.import similarity index 70% rename from 2d/gd_paint/PaintTools.png.import rename to 2d/gd_paint/paint_tools.png.import index 8763b5e3..b4247fd7 100644 --- a/2d/gd_paint/PaintTools.png.import +++ b/2d/gd_paint/paint_tools.png.import @@ -2,15 +2,15 @@ importer="texture" type="StreamTexture" -path="res://.import/PaintTools.png-636e86a6d210b52282c946752bbcc6f1.stex" +path="res://.import/paint_tools.png-224b64b7ddb26189a369199f6d686b79.stex" metadata={ "vram_texture": false } [deps] -source_file="res://PaintTools.png" -dest_files=[ "res://.import/PaintTools.png-636e86a6d210b52282c946752bbcc6f1.stex" ] +source_file="res://paint_tools.png" +dest_files=[ "res://.import/paint_tools.png-224b64b7ddb26189a369199f6d686b79.stex" ] [params] diff --git a/2d/gd_paint/project.godot b/2d/gd_paint/project.godot index 6859e203..7922e242 100644 --- a/2d/gd_paint/project.godot +++ b/2d/gd_paint/project.godot @@ -19,7 +19,7 @@ config/name="GD Paint" config/description="GD Paint is a simple image editor made using Godot and GDScript. It supports different types of 'brushes': a basic pen/pencil and eraser, as well as a rectangle and a circle brush." -run/main_scene="res://Paint_root.tscn" +run/main_scene="res://paint_root.tscn" config/icon="res://icon.png" [display] diff --git a/2d/gd_paint/ToolsPanel.gd b/2d/gd_paint/tools_panel.gd similarity index 91% rename from 2d/gd_paint/ToolsPanel.gd rename to 2d/gd_paint/tools_panel.gd index 894427b1..a5ea0a4e 100644 --- a/2d/gd_paint/ToolsPanel.gd +++ b/2d/gd_paint/tools_panel.gd @@ -1,20 +1,16 @@ extends Panel -var paint_control - onready var brush_settings = $BrushSettings -onready var label_tools = $LabelTools -onready var label_brush_size = $BrushSettings/LabelBrushSize -onready var label_brush_shape = $BrushSettings/LabelBrushShape +onready var label_brush_size = brush_settings.get_node(@"LabelBrushSize") +onready var label_brush_shape = brush_settings.get_node(@"LabelBrushShape") onready var label_stats = $LabelStats +onready var label_tools = $LabelTools -var save_dialog +onready var _parent = get_parent() +onready var save_dialog = _parent.get_node(@"SaveFileDialog") +onready var paint_control = _parent.get_node(@"PaintControl") func _ready(): - # Get PaintControl and SaveFileDialog. - paint_control = get_parent().get_node("PaintControl") - save_dialog = get_parent().get_node("SaveFileDialog") - # warning-ignore-all:return_value_discarded # Assign all of the needed signals for the oppersation buttons. $ButtonUndo.connect("pressed", self, "button_pressed", ["undo_stroke"]) @@ -34,7 +30,7 @@ func _ready(): $ColorPickerBackground.connect("color_changed", self, "background_color_changed") $BrushSettings/HScrollBarBrushSize.connect("value_changed", self, "brush_size_changed") - # Assign the 'file_selected' signal in SaveFileDialog. + # Assign the "file_selected" signal in SaveFileDialog. save_dialog.connect("file_selected", self, "save_file_selected") # Set physics process so we can update the status label. diff --git a/2d/hexagonal_map/troll.gd b/2d/hexagonal_map/troll.gd index 10b7e641..383588f0 100644 --- a/2d/hexagonal_map/troll.gd +++ b/2d/hexagonal_map/troll.gd @@ -1,12 +1,13 @@ extends KinematicBody2D const MOTION_SPEED = 160 # Pixels/second. +const TAN30DEG = tan(deg2rad(30)) func _physics_process(_delta): var motion = Vector2() motion.x = Input.get_action_strength("move_right") - Input.get_action_strength("move_left") motion.y = Input.get_action_strength("move_down") - Input.get_action_strength("move_up") - motion.y *= 0.57735056839 # tan(30 degrees). + motion.y *= TAN30DEG motion = motion.normalized() * MOTION_SPEED #warning-ignore:return_value_discarded move_and_slide(motion) diff --git a/2d/isometric/troll.gd b/2d/isometric/troll.gd index fa9f0704..7c5d1048 100644 --- a/2d/isometric/troll.gd +++ b/2d/isometric/troll.gd @@ -6,7 +6,7 @@ func _physics_process(_delta): var motion = Vector2() motion.x = Input.get_action_strength("move_right") - Input.get_action_strength("move_left") motion.y = Input.get_action_strength("move_down") - Input.get_action_strength("move_up") - motion.y *= 0.5 + motion.y /= 2 motion = motion.normalized() * MOTION_SPEED #warning-ignore:return_value_discarded move_and_slide(motion) diff --git a/2d/navigation/navigation.gd b/2d/navigation/navigation.gd index d5934a6d..17967cf8 100644 --- a/2d/navigation/navigation.gd +++ b/2d/navigation/navigation.gd @@ -3,33 +3,35 @@ extends Navigation2D export(float) var character_speed = 400.0 var path = [] +onready var character = $Character + func _process(delta): var walk_distance = character_speed * delta move_along_path(walk_distance) -# The 'click' event is a custom input action defined in +# The "click" event is a custom input action defined in # Project > Project Settings > Input Map tab. func _unhandled_input(event): if not event.is_action_pressed("click"): return - _update_navigation_path($Character.position, get_local_mouse_position()) + _update_navigation_path(character.position, get_local_mouse_position()) func move_along_path(distance): - var last_point = $Character.position + var last_point = character.position while path.size(): var distance_between_points = last_point.distance_to(path[0]) # The position to move to falls between two points. if distance <= distance_between_points: - $Character.position = last_point.linear_interpolate(path[0], distance / distance_between_points) + character.position = last_point.linear_interpolate(path[0], distance / distance_between_points) return # The position is past the end of the segment. distance -= distance_between_points last_point = path[0] path.remove(0) # The character reached the end of the path. - $Character.position = last_point + character.position = last_point set_process(false) diff --git a/2d/navigation_astar/character.gd b/2d/navigation_astar/character.gd index b61a231e..98a8eed9 100644 --- a/2d/navigation_astar/character.gd +++ b/2d/navigation_astar/character.gd @@ -2,6 +2,9 @@ extends Node2D enum States { IDLE, FOLLOW } +const MASS = 10.0 +const ARRIVE_DISTANCE = 10.0 + export(float) var speed = 200.0 var _state = null @@ -38,9 +41,6 @@ func _unhandled_input(event): func _move_to(world_position): - var MASS = 10.0 - var ARRIVE_DISTANCE = 10.0 - var desired_velocity = (world_position - position).normalized() * speed var steering = desired_velocity - _velocity _velocity += steering / MASS @@ -55,7 +55,7 @@ func _change_state(new_state): if not _path or len(_path) == 1: _change_state(States.IDLE) return - # The index 0 is the starting cell - # we don't want the character to move back to it in this example + # The index 0 is the starting cell. + # We don't want the character to move back to it in this example. _target_point_world = _path[1] _state = new_state diff --git a/2d/physics_platformer/player/player.gd b/2d/physics_platformer/player/player.gd index 3667e106..a85eaa8d 100644 --- a/2d/physics_platformer/player/player.gd +++ b/2d/physics_platformer/player/player.gd @@ -47,6 +47,13 @@ var shoot_time = 1e20 var Bullet = preload("res://player/Bullet.tscn") var Enemy = preload("res://enemy/Enemy.tscn") +onready var sound_jump = $SoundJump +onready var sound_shoot = $SoundShoot +onready var sprite = $Sprite +onready var sprite_smoke = sprite.get_node(@"Smoke") +onready var animation_player = $AnimationPlayer +onready var bullet_shoot = $BulletShoot + func _integrate_forces(s): var lv = s.get_linear_velocity() var step = s.get_step() @@ -54,7 +61,7 @@ func _integrate_forces(s): var new_anim = anim var new_siding_left = siding_left - # Get the controls. + # Get player input. var move_left = Input.is_action_pressed("move_left") var move_right = Input.is_action_pressed("move_right") var jump = Input.is_action_pressed("jump") @@ -124,7 +131,7 @@ func _integrate_forces(s): lv.y = -JUMP_VELOCITY jumping = true stopping_jump = false - ($SoundJump as AudioStreamPlayer2D).play() + sound_jump.play() # Check siding. if lv.x < 0 and move_left: @@ -173,16 +180,16 @@ func _integrate_forces(s): # Update siding. if new_siding_left != siding_left: if new_siding_left: - ($Sprite as Sprite).scale.x = -1 + sprite.scale.x = -1 else: - ($Sprite as Sprite).scale.x = 1 + sprite.scale.x = 1 siding_left = new_siding_left # Change animation. if new_anim != anim: anim = new_anim - ($AnimationPlayer as AnimationPlayer).play(anim) + animation_player.play(anim) shooting = shoot @@ -204,15 +211,15 @@ func _shot_bullet(): ss = -1.0 else: ss = 1.0 - var pos = position + ($BulletShoot as Position2D).position * Vector2(ss, 1.0) + var pos = position + bullet_shoot.position * Vector2(ss, 1.0) bi.position = pos get_parent().add_child(bi) bi.linear_velocity = Vector2(400.0 * ss, -40) - ($Sprite/Smoke as Particles2D).restart() - ($SoundShoot as AudioStreamPlayer2D).play() + sprite_smoke.restart() + sound_shoot.play() add_collision_exception_with(bi) # Make bullet and this not collide. diff --git a/2d/platformer/src/Actors/Enemy.gd b/2d/platformer/src/Actors/Enemy.gd index 0ed30b5b..4bef2228 100644 --- a/2d/platformer/src/Actors/Enemy.gd +++ b/2d/platformer/src/Actors/Enemy.gd @@ -36,7 +36,14 @@ func _ready(): # - If you split the character into a state machine or more advanced pattern, # you can easily move individual functions. func _physics_process(_delta): - _velocity = calculate_move_velocity(_velocity) + # If the enemy encounters a wall or an edge, the horizontal velocity is flipped. + if not floor_detector_left.is_colliding(): + _velocity.x = speed.x + elif not floor_detector_right.is_colliding(): + _velocity.x = -speed.x + + if is_on_wall(): + _velocity.x *= -1 # We only update the y value of _velocity as we want to handle the horizontal movement ourselves. _velocity.y = move_and_slide(_velocity, FLOOR_NORMAL).y @@ -49,22 +56,6 @@ func _physics_process(_delta): animation_player.play(animation) -# This function calculates a new velocity whenever you need it. -# If the enemy encounters a wall or an edge, the horizontal velocity is flipped. -func calculate_move_velocity(linear_velocity): - var velocity = linear_velocity - - if not floor_detector_left.is_colliding(): - velocity.x = speed.x - elif not floor_detector_right.is_colliding(): - velocity.x = -speed.x - - if is_on_wall(): - velocity.x *= -1 - - return velocity - - func destroy(): _state = State.DEAD _velocity = Vector2.ZERO diff --git a/2d/platformer/src/Actors/Gun.gd b/2d/platformer/src/Actors/Gun.gd index 224363b2..9a146ed0 100644 --- a/2d/platformer/src/Actors/Gun.gd +++ b/2d/platformer/src/Actors/Gun.gd @@ -11,6 +11,7 @@ onready var sound_shoot = $Shoot onready var timer = $Cooldown +# This method is only called by Player.gd. func shoot(direction = 1): if not timer.is_stopped(): return false diff --git a/2d/platformer/src/Actors/Player.gd b/2d/platformer/src/Actors/Player.gd index eca4d727..fb623f06 100644 --- a/2d/platformer/src/Actors/Player.gd +++ b/2d/platformer/src/Actors/Player.gd @@ -7,10 +7,10 @@ const FLOOR_DETECT_DISTANCE = 20.0 export(String) var action_suffix = "" onready var platform_detector = $PlatformDetector -onready var sprite = $Sprite onready var animation_player = $AnimationPlayer onready var shoot_timer = $ShootAnimation -onready var gun = $Sprite/Gun +onready var sprite = $Sprite +onready var gun = sprite.get_node(@"Gun") func _ready(): diff --git a/2d/platformer/src/Objects/Coin.gd b/2d/platformer/src/Objects/Coin.gd index 7cd6eb32..10575c36 100644 --- a/2d/platformer/src/Objects/Coin.gd +++ b/2d/platformer/src/Objects/Coin.gd @@ -7,7 +7,7 @@ onready var animation_player = $AnimationPlayer # The Coins only detects collisions with the Player thanks to its collision mask. # This prevents other characters such as enemies from picking up coins. -# When the player collides with a coin, the coin plays its 'picked' animation. +# When the player collides with a coin, the coin plays its "picked" animation. # The animation takes cares of making the coin disappear, but also deactivates its # collisions and frees it from memory, saving us from writing more complex code. # Click the AnimationPlayer node to see the animation timeline. diff --git a/2d/pong/scripts/ball.gd b/2d/pong/logic/ball.gd similarity index 100% rename from 2d/pong/scripts/ball.gd rename to 2d/pong/logic/ball.gd diff --git a/2d/pong/scripts/ceiling_floor.gd b/2d/pong/logic/ceiling_floor.gd similarity index 100% rename from 2d/pong/scripts/ceiling_floor.gd rename to 2d/pong/logic/ceiling_floor.gd diff --git a/2d/pong/scripts/paddle.gd b/2d/pong/logic/paddle.gd similarity index 100% rename from 2d/pong/scripts/paddle.gd rename to 2d/pong/logic/paddle.gd diff --git a/2d/pong/scripts/wall.gd b/2d/pong/logic/wall.gd similarity index 100% rename from 2d/pong/scripts/wall.gd rename to 2d/pong/logic/wall.gd diff --git a/2d/pong/pong.tscn b/2d/pong/pong.tscn index d9942945..ee2f72e0 100644 --- a/2d/pong/pong.tscn +++ b/2d/pong/pong.tscn @@ -1,13 +1,13 @@ [gd_scene load_steps=13 format=2] -[ext_resource path="res://scripts/paddle.gd" type="Script" id=1] +[ext_resource path="res://logic/paddle.gd" type="Script" id=1] [ext_resource path="res://left_pallete.png" type="Texture" id=2] [ext_resource path="res://right_pallete.png" type="Texture" id=3] -[ext_resource path="res://scripts/ball.gd" type="Script" id=4] +[ext_resource path="res://logic/ball.gd" type="Script" id=4] [ext_resource path="res://ball.png" type="Texture" id=5] [ext_resource path="res://separator.png" type="Texture" id=6] -[ext_resource path="res://scripts/wall.gd" type="Script" id=7] -[ext_resource path="res://scripts/ceiling_floor.gd" type="Script" id=8] +[ext_resource path="res://logic/wall.gd" type="Script" id=7] +[ext_resource path="res://logic/ceiling_floor.gd" type="Script" id=8] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 4, 16 ) diff --git a/2d/role_playing_game/grid_movement/pawns/Actor.gd b/2d/role_playing_game/grid_movement/pawns/Actor.gd index 3bea223b..4b4e4b06 100644 --- a/2d/role_playing_game/grid_movement/pawns/Actor.gd +++ b/2d/role_playing_game/grid_movement/pawns/Actor.gd @@ -1,4 +1,4 @@ -extends 'Pawn.gd' +extends "Pawn.gd" onready var Grid = get_parent() var lost = false diff --git a/2d/role_playing_game/grid_movement/pawns/Character.gd b/2d/role_playing_game/grid_movement/pawns/Character.gd index 39011fb7..e8adacaa 100644 --- a/2d/role_playing_game/grid_movement/pawns/Character.gd +++ b/2d/role_playing_game/grid_movement/pawns/Character.gd @@ -1,7 +1,7 @@ -extends 'Pawn.gd' +extends "Pawn.gd" #warning-ignore:unused_class_variable -export (PackedScene) var combat_actor +export(PackedScene) var combat_actor #warning-ignore:unused_class_variable var lost = false diff --git a/2d/role_playing_game/grid_movement/pawns/IdleActor.gd b/2d/role_playing_game/grid_movement/pawns/IdleActor.gd index da9069ca..64bab0e8 100644 --- a/2d/role_playing_game/grid_movement/pawns/IdleActor.gd +++ b/2d/role_playing_game/grid_movement/pawns/IdleActor.gd @@ -1,4 +1,4 @@ -extends 'Actor.gd' +extends "Actor.gd" func _ready(): set_process(false) diff --git a/2d/role_playing_game/grid_movement/pawns/Walker.gd b/2d/role_playing_game/grid_movement/pawns/Walker.gd index bd21596b..b305446b 100644 --- a/2d/role_playing_game/grid_movement/pawns/Walker.gd +++ b/2d/role_playing_game/grid_movement/pawns/Walker.gd @@ -1,8 +1,8 @@ -extends 'Pawn.gd' +extends "Pawn.gd" onready var Grid = get_parent() #warning-ignore:unused_class_variable -export (PackedScene) var combat_actor +export(PackedScene) var combat_actor #warning-ignore:unused_class_variable var lost = false diff --git a/2d/role_playing_game/screens/combat/interface/UI.gd b/2d/role_playing_game/screens/combat/interface/UI.gd index bf6008cf..8644bf23 100644 --- a/2d/role_playing_game/screens/combat/interface/UI.gd +++ b/2d/role_playing_game/screens/combat/interface/UI.gd @@ -1,7 +1,7 @@ extends Control -export (NodePath) var combatants_node -export (PackedScene) var info_scene +export(NodePath) var combatants_node +export(PackedScene) var info_scene func _ready(): combatants_node = get_node(combatants_node) diff --git a/3d/material_testers/tester.gd b/3d/material_testers/tester.gd index d2d6dbd0..a27788a5 100644 --- a/3d/material_testers/tester.gd +++ b/3d/material_testers/tester.gd @@ -33,7 +33,7 @@ func _ready(): func _unhandled_input(ev): - if ev is InputEventMouseButton : + if ev is InputEventMouseButton: if ev.button_index == BUTTON_WHEEL_UP: zoom -= ZOOM_SPEED if ev.button_index == BUTTON_WHEEL_DOWN: diff --git a/3d/physics_tests/tests.gd b/3d/physics_tests/tests.gd index d5e31cf8..02544820 100644 --- a/3d/physics_tests/tests.gd +++ b/3d/physics_tests/tests.gd @@ -3,20 +3,20 @@ extends Node var _tests = [ { - "id" : "Functional Tests/Shapes", - "path" : "res://tests/functional/test_shapes.tscn", + "id": "Functional Tests/Shapes", + "path": "res://tests/functional/test_shapes.tscn", }, { - "id" : "Functional Tests/Compound Shapes", - "path" : "res://tests/functional/test_compound_shapes.tscn", + "id": "Functional Tests/Compound Shapes", + "path": "res://tests/functional/test_compound_shapes.tscn", }, { - "id" : "Functional Tests/Friction", - "path" : "res://tests/functional/test_friction.tscn", + "id": "Functional Tests/Friction", + "path": "res://tests/functional/test_friction.tscn", }, { - "id" : "Performance Tests/Contacts", - "path" : "res://tests/performance/test_perf_contacts.tscn", + "id": "Performance Tests/Contacts", + "path": "res://tests/performance/test_perf_contacts.tscn", }, ] diff --git a/3d/physics_tests/tests_menu.gd b/3d/physics_tests/tests_menu.gd index 0a38041d..ffe116ad 100644 --- a/3d/physics_tests/tests_menu.gd +++ b/3d/physics_tests/tests_menu.gd @@ -1,7 +1,7 @@ extends OptionMenu -class TestData : +class TestData: var id var scene_path diff --git a/misc/sensors/main.gd b/misc/sensors/main.gd index feefa11a..28e51417 100644 --- a/misc/sensors/main.gd +++ b/misc/sensors/main.gd @@ -98,9 +98,9 @@ func _process(delta): var gyro = Input.get_gyroscope() # Show our base values - get_node("Control/Accelerometer").text = 'Accelerometer: ' + str(acc) + ', gravity: ' + str(grav) - get_node("Control/Magnetometer").text = 'Magnetometer: ' + str(mag) - get_node("Control/Gyroscope").text = 'Gyroscope: ' + str(gyro) + get_node("Control/Accelerometer").text = "Accelerometer: " + str(acc) + ", gravity: " + str(grav) + get_node("Control/Magnetometer").text = "Magnetometer: " + str(mag) + get_node("Control/Gyroscope").text = "Gyroscope: " + str(gyro) # Check if we have all needed data if grav.length() < 0.1: @@ -136,5 +136,3 @@ func _process(delta): var gyro_and_grav = get_node("Boxes/GyroAndGrav") var new_basis = rotate_by_gyro(gyro, gyro_and_grav.transform.basis, delta).orthonormalized() gyro_and_grav.transform.basis = drift_correction(new_basis, grav) - - diff --git a/misc/tween/main.gd b/misc/tween/main.gd index c900b05b..e6c2a9a4 100644 --- a/misc/tween/main.gd +++ b/misc/tween/main.gd @@ -111,8 +111,8 @@ func reset_tween(): tween.interpolate_property(sprite, "rotation_degrees", 360, 0, 2, state.trans, state.eases, 2) if $Modes/Callback.is_pressed(): - tween.interpolate_callback(self, 0.5, "on_callback", "0.5 second's after") - tween.interpolate_callback(self, 0.2, "on_callback", "1.2 second's after") + tween.interpolate_callback(self, 0.5, "on_callback", "0.5 seconds after") + tween.interpolate_callback(self, 0.2, "on_callback", "1.2 seconds after") if $Modes/Follow.is_pressed(): follow.show() diff --git a/mono/2.5d/2.5D Demo (Mono C#).csproj b/mono/2.5d/2.5D Demo (Mono C#).csproj index 0dbfc3d1..35a8c87a 100644 --- a/mono/2.5d/2.5D Demo (Mono C#).csproj +++ b/mono/2.5d/2.5D Demo (Mono C#).csproj @@ -11,10 +11,11 @@ v4.5 .mono/temp/obj $(BaseIntermediateOutputPath)/$(Configuration) - Debug - Release + Debug + Release + 1.0.0.0 - + true portable false @@ -23,7 +24,7 @@ 4 false - + portable true $(GodotDefineConstants);GODOT; @@ -31,7 +32,7 @@ 4 false - + true portable false @@ -45,7 +46,7 @@ False $(ProjectDir)/.mono/assemblies/$(ApiConfiguration)/GodotSharp.dll - + False $(ProjectDir)/.mono/assemblies/$(ApiConfiguration)/GodotSharpEditor.dll @@ -63,5 +64,11 @@ + + + 1.0.0 + All + + - + \ No newline at end of file diff --git a/mono/2.5d/2.5D Demo (Mono C#).sln b/mono/2.5d/2.5D Demo (Mono C#).sln index d979d457..0175e811 100644 --- a/mono/2.5d/2.5D Demo (Mono C#).sln +++ b/mono/2.5d/2.5D Demo (Mono C#).sln @@ -5,15 +5,15 @@ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - Tools|Any CPU = Tools|Any CPU + ExportDebug|Any CPU = ExportDebug|Any CPU + ExportRelease|Any CPU = ExportRelease|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {5CA791DB-5050-44D0-989B-41D559AB1D50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5CA791DB-5050-44D0-989B-41D559AB1D50}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5CA791DB-5050-44D0-989B-41D559AB1D50}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5CA791DB-5050-44D0-989B-41D559AB1D50}.Release|Any CPU.Build.0 = Release|Any CPU - {5CA791DB-5050-44D0-989B-41D559AB1D50}.Tools|Any CPU.ActiveCfg = Tools|Any CPU - {5CA791DB-5050-44D0-989B-41D559AB1D50}.Tools|Any CPU.Build.0 = Tools|Any CPU + {5CA791DB-5050-44D0-989B-41D559AB1D50}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU + {5CA791DB-5050-44D0-989B-41D559AB1D50}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU + {5CA791DB-5050-44D0-989B-41D559AB1D50}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU + {5CA791DB-5050-44D0-989B-41D559AB1D50}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU EndGlobalSection EndGlobal diff --git a/mono/README.md b/mono/README.md new file mode 100644 index 00000000..9fae9115 --- /dev/null +++ b/mono/README.md @@ -0,0 +1,4 @@ +# Note: Godot 3.2.2 or newer is required + +While most of the demos work with any 3.2.x version, these demos require +at least Godot 3.2.2 since there are large C#-specific changes in 3.2.2. diff --git a/mono/dodge_the_creeps/Dodge the Creeps with C#.csproj b/mono/dodge_the_creeps/Dodge the Creeps with C#.csproj index a8605624..86ec3a9e 100644 --- a/mono/dodge_the_creeps/Dodge the Creeps with C#.csproj +++ b/mono/dodge_the_creeps/Dodge the Creeps with C#.csproj @@ -1,7 +1,7 @@  - Tools + Debug AnyCPU {75CB0382-CCCC-4A4D-ABF0-C6CD04D9F832} Library @@ -12,10 +12,10 @@ 1.0.7374.16792 .mono\temp\obj $(BaseIntermediateOutputPath)\$(Configuration) - Debug - Release + Debug + Release - + true portable false @@ -24,7 +24,7 @@ 4 false - + portable true $(GodotDefineConstants);GODOT; @@ -32,7 +32,7 @@ 4 false - + true portable false @@ -43,12 +43,12 @@ - $(ProjectDir)\.mono\assemblies\$(ApiConfiguration)\GodotSharp.dll False + $(ProjectDir)/.mono/assemblies/$(ApiConfiguration)/GodotSharp.dll - - $(ProjectDir)\.mono\assemblies\$(ApiConfiguration)\GodotSharpEditor.dll + False + $(ProjectDir)/.mono/assemblies/$(ApiConfiguration)/GodotSharpEditor.dll @@ -59,5 +59,11 @@ + + + 1.0.0 + All + + \ No newline at end of file diff --git a/mono/dodge_the_creeps/Dodge the Creeps with C#.sln b/mono/dodge_the_creeps/Dodge the Creeps with C#.sln index 7e369f97..23b34d8b 100644 --- a/mono/dodge_the_creeps/Dodge the Creeps with C#.sln +++ b/mono/dodge_the_creeps/Dodge the Creeps with C#.sln @@ -5,15 +5,15 @@ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - Tools|Any CPU = Tools|Any CPU + ExportDebug|Any CPU = ExportDebug|Any CPU + ExportRelease|Any CPU = ExportRelease|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {75CB0382-CCCC-4A4D-ABF0-C6CD04D9F832}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {75CB0382-CCCC-4A4D-ABF0-C6CD04D9F832}.Debug|Any CPU.Build.0 = Debug|Any CPU - {75CB0382-CCCC-4A4D-ABF0-C6CD04D9F832}.Release|Any CPU.ActiveCfg = Release|Any CPU - {75CB0382-CCCC-4A4D-ABF0-C6CD04D9F832}.Release|Any CPU.Build.0 = Release|Any CPU - {75CB0382-CCCC-4A4D-ABF0-C6CD04D9F832}.Tools|Any CPU.ActiveCfg = Tools|Any CPU - {75CB0382-CCCC-4A4D-ABF0-C6CD04D9F832}.Tools|Any CPU.Build.0 = Tools|Any CPU + {75CB0382-CCCC-4A4D-ABF0-C6CD04D9F832}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU + {75CB0382-CCCC-4A4D-ABF0-C6CD04D9F832}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU + {75CB0382-CCCC-4A4D-ABF0-C6CD04D9F832}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU + {75CB0382-CCCC-4A4D-ABF0-C6CD04D9F832}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU EndGlobalSection EndGlobal diff --git a/mono/dodge_the_creeps/Main.cs b/mono/dodge_the_creeps/Main.cs index 282ab7e0..8b89d106 100644 --- a/mono/dodge_the_creeps/Main.cs +++ b/mono/dodge_the_creeps/Main.cs @@ -73,13 +73,13 @@ public class Main : Node AddChild(mobInstance); // Set the mob's direction perpendicular to the path direction. - float direction = mobSpawnLocation.Rotation + Mathf.Pi / 2; + float direction = mobSpawnLocation.Rotation + Mathf.Tau / 4; // Set the mob's position to a random location. mobInstance.Position = mobSpawnLocation.Position; // Add some randomness to the direction. - direction += RandRange(-Mathf.Pi / 4, Mathf.Pi / 4); + direction += RandRange(-Mathf.Tau / 8, Mathf.Tau / 8); mobInstance.Rotation = direction; // Choose the velocity. diff --git a/mono/pong/Scripts/Ball.cs b/mono/pong/Logic/Ball.cs similarity index 100% rename from mono/pong/Scripts/Ball.cs rename to mono/pong/Logic/Ball.cs diff --git a/mono/pong/Scripts/CeilingFloor.cs b/mono/pong/Logic/CeilingFloor.cs similarity index 100% rename from mono/pong/Scripts/CeilingFloor.cs rename to mono/pong/Logic/CeilingFloor.cs diff --git a/mono/pong/Scripts/Paddle.cs b/mono/pong/Logic/Paddle.cs similarity index 100% rename from mono/pong/Scripts/Paddle.cs rename to mono/pong/Logic/Paddle.cs diff --git a/mono/pong/Scripts/Wall.cs b/mono/pong/Logic/Wall.cs similarity index 100% rename from mono/pong/Scripts/Wall.cs rename to mono/pong/Logic/Wall.cs diff --git a/mono/pong/Pong with C#.csproj b/mono/pong/Pong with C#.csproj index 4ac27b57..85980ee2 100644 --- a/mono/pong/Pong with C#.csproj +++ b/mono/pong/Pong with C#.csproj @@ -11,10 +11,11 @@ v4.5 .mono/temp/obj $(BaseIntermediateOutputPath)/$(Configuration) - Debug - Release + Debug + Release + 1.0.0.0 - + true portable false @@ -23,7 +24,7 @@ 4 false - + portable true $(GodotDefineConstants);GODOT; @@ -31,7 +32,7 @@ 4 false - + true portable false @@ -45,7 +46,7 @@ False $(ProjectDir)/.mono/assemblies/$(ApiConfiguration)/GodotSharp.dll - + False $(ProjectDir)/.mono/assemblies/$(ApiConfiguration)/GodotSharpEditor.dll @@ -53,10 +54,16 @@ - - - - + + + + + + + + 1.0.0 + All + \ No newline at end of file diff --git a/mono/pong/Pong with C#.sln b/mono/pong/Pong with C#.sln index aea56c5d..7f5db47c 100644 --- a/mono/pong/Pong with C#.sln +++ b/mono/pong/Pong with C#.sln @@ -5,15 +5,15 @@ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - Tools|Any CPU = Tools|Any CPU + ExportDebug|Any CPU = ExportDebug|Any CPU + ExportRelease|Any CPU = ExportRelease|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {EBA5981B-C37E-48C5-A3B6-4390D9834F9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EBA5981B-C37E-48C5-A3B6-4390D9834F9A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EBA5981B-C37E-48C5-A3B6-4390D9834F9A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EBA5981B-C37E-48C5-A3B6-4390D9834F9A}.Release|Any CPU.Build.0 = Release|Any CPU - {EBA5981B-C37E-48C5-A3B6-4390D9834F9A}.Tools|Any CPU.ActiveCfg = Tools|Any CPU - {EBA5981B-C37E-48C5-A3B6-4390D9834F9A}.Tools|Any CPU.Build.0 = Tools|Any CPU + {EBA5981B-C37E-48C5-A3B6-4390D9834F9A}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU + {EBA5981B-C37E-48C5-A3B6-4390D9834F9A}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU + {EBA5981B-C37E-48C5-A3B6-4390D9834F9A}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU + {EBA5981B-C37E-48C5-A3B6-4390D9834F9A}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU EndGlobalSection EndGlobal diff --git a/mono/pong/pong.tscn b/mono/pong/pong.tscn index 9724a5d8..d5401a8a 100644 --- a/mono/pong/pong.tscn +++ b/mono/pong/pong.tscn @@ -1,13 +1,13 @@ [gd_scene load_steps=13 format=2] -[ext_resource path="res://Scripts/Paddle.cs" type="Script" id=1] +[ext_resource path="res://Logic/Paddle.cs" type="Script" id=1] [ext_resource path="res://left_pallete.png" type="Texture" id=2] [ext_resource path="res://right_pallete.png" type="Texture" id=3] -[ext_resource path="res://Scripts/Ball.cs" type="Script" id=4] +[ext_resource path="res://Logic/Ball.cs" type="Script" id=4] [ext_resource path="res://ball.png" type="Texture" id=5] [ext_resource path="res://separator.png" type="Texture" id=6] -[ext_resource path="res://Scripts/Wall.cs" type="Script" id=7] -[ext_resource path="res://Scripts/CeilingFloor.cs" type="Script" id=8] +[ext_resource path="res://Logic/Wall.cs" type="Script" id=7] +[ext_resource path="res://Logic/CeilingFloor.cs" type="Script" id=8] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 4, 16 ) diff --git a/networking/multiplayer_pong/ball.tscn b/networking/multiplayer_pong/ball.tscn index 3972f3c5..57bf92e5 100644 --- a/networking/multiplayer_pong/ball.tscn +++ b/networking/multiplayer_pong/ball.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=4 format=2] -[ext_resource path="res://scripts/ball.gd" type="Script" id=1] +[ext_resource path="res://logic/ball.gd" type="Script" id=1] [ext_resource path="res://ball.png" type="Texture" id=2] [sub_resource type="CircleShape2D" id=1] diff --git a/networking/multiplayer_pong/lobby.tscn b/networking/multiplayer_pong/lobby.tscn index 998a1b6e..6dfdf808 100644 --- a/networking/multiplayer_pong/lobby.tscn +++ b/networking/multiplayer_pong/lobby.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=2 format=2] -[ext_resource path="res://scripts/lobby.gd" type="Script" id=1] +[ext_resource path="res://logic/lobby.gd" type="Script" id=1] [node name="Lobby" type="Control"] anchor_left = 0.5 diff --git a/networking/multiplayer_pong/scripts/ball.gd b/networking/multiplayer_pong/logic/ball.gd similarity index 100% rename from networking/multiplayer_pong/scripts/ball.gd rename to networking/multiplayer_pong/logic/ball.gd diff --git a/networking/multiplayer_pong/scripts/lobby.gd b/networking/multiplayer_pong/logic/lobby.gd similarity index 100% rename from networking/multiplayer_pong/scripts/lobby.gd rename to networking/multiplayer_pong/logic/lobby.gd diff --git a/networking/multiplayer_pong/scripts/paddle.gd b/networking/multiplayer_pong/logic/paddle.gd similarity index 100% rename from networking/multiplayer_pong/scripts/paddle.gd rename to networking/multiplayer_pong/logic/paddle.gd diff --git a/networking/multiplayer_pong/scripts/pong.gd b/networking/multiplayer_pong/logic/pong.gd similarity index 100% rename from networking/multiplayer_pong/scripts/pong.gd rename to networking/multiplayer_pong/logic/pong.gd diff --git a/networking/multiplayer_pong/paddle.tscn b/networking/multiplayer_pong/paddle.tscn index 3259ccd9..0385b831 100644 --- a/networking/multiplayer_pong/paddle.tscn +++ b/networking/multiplayer_pong/paddle.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=4 format=2] -[ext_resource path="res://scripts/paddle.gd" type="Script" id=1] +[ext_resource path="res://logic/paddle.gd" type="Script" id=1] [ext_resource path="res://paddle.png" type="Texture" id=2] [sub_resource type="CapsuleShape2D" id=1] diff --git a/networking/multiplayer_pong/pong.tscn b/networking/multiplayer_pong/pong.tscn index a2f83500..b61c0752 100644 --- a/networking/multiplayer_pong/pong.tscn +++ b/networking/multiplayer_pong/pong.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=5 format=2] -[ext_resource path="res://scripts/pong.gd" type="Script" id=1] +[ext_resource path="res://logic/pong.gd" type="Script" id=1] [ext_resource path="res://separator.png" type="Texture" id=2] [ext_resource path="res://paddle.tscn" type="PackedScene" id=3] [ext_resource path="res://ball.tscn" type="PackedScene" id=4] diff --git a/networking/webrtc_signaling/client/multiplayer_client.gd b/networking/webrtc_signaling/client/multiplayer_client.gd index 154c1be2..4f088a23 100644 --- a/networking/webrtc_signaling/client/multiplayer_client.gd +++ b/networking/webrtc_signaling/client/multiplayer_client.gd @@ -30,7 +30,7 @@ func stop(): func _create_peer(id): - var peer : WebRTCPeerConnection = WebRTCPeerConnection.new() + var peer: WebRTCPeerConnection = WebRTCPeerConnection.new() peer.initialize({ "iceServers": [ { "urls": ["stun:stun.l.google.com:19302"] } ] }) diff --git a/networking/webrtc_signaling/client/ws_webrtc_client.gd b/networking/webrtc_signaling/client/ws_webrtc_client.gd index 5e88a7a6..f95a7d76 100644 --- a/networking/webrtc_signaling/client/ws_webrtc_client.gd +++ b/networking/webrtc_signaling/client/ws_webrtc_client.gd @@ -52,13 +52,13 @@ func _connected(protocol = ""): func _parse_msg(): - var pkt_str : String = client.get_peer(1).get_packet().get_string_from_utf8() + var pkt_str: String = client.get_peer(1).get_packet().get_string_from_utf8() - var req : PoolStringArray = pkt_str.split('\n', true, 1) + var req: PoolStringArray = pkt_str.split("\n", true, 1) if req.size() != 2: # Invalid request size return - var type : String = req[0] + var type: String = req[0] if type.length() < 3: # Invalid type size return @@ -69,11 +69,11 @@ func _parse_msg(): emit_signal("lobby_sealed") return - var src_str : String = type.substr(3, type.length() - 3) + var src_str: String = type.substr(3, type.length() - 3) if not src_str.is_valid_integer(): # Source id is not an integer return - var src_id : int = int(src_str) + var src_id: int = int(src_str) if type.begins_with("I: "): emit_signal("connected", src_id) @@ -91,7 +91,7 @@ func _parse_msg(): emit_signal("answer_received", src_id, req[1]) elif type.begins_with("C: "): # Candidate received - var candidate : PoolStringArray = req[1].split('\n', false) + var candidate: PoolStringArray = req[1].split("\n", false) if candidate.size() != 3: return if not candidate[1].is_valid_integer(): @@ -124,6 +124,6 @@ func _send_msg(type, id, data) -> int: func _process(delta): - var status : int = client.get_connection_status() + var status: int = client.get_connection_status() if status == WebSocketClient.CONNECTION_CONNECTING or status == WebSocketClient.CONNECTION_CONNECTED: client.poll() diff --git a/networking/webrtc_signaling/demo/client_ui.gd b/networking/webrtc_signaling/demo/client_ui.gd index a61dc110..3b862ee8 100644 --- a/networking/webrtc_signaling/demo/client_ui.gd +++ b/networking/webrtc_signaling/demo/client_ui.gd @@ -43,11 +43,11 @@ func _mp_server_disconnect(): _log("Multiplayer is disconnected (I am %d)" % client.rtc_mp.get_unique_id()) -func _mp_peer_connected(id : int): +func _mp_peer_connected(id: int): _log("Multiplayer peer %d connected" % id) -func _mp_peer_disconnected(id : int): +func _mp_peer_disconnected(id: int): _log("Multiplayer peer %d disconnected" % id) diff --git a/networking/webrtc_signaling/server/ws_webrtc_server.gd b/networking/webrtc_signaling/server/ws_webrtc_server.gd index 5c1833c6..d40cd6f8 100644 --- a/networking/webrtc_signaling/server/ws_webrtc_server.gd +++ b/networking/webrtc_signaling/server/ws_webrtc_server.gd @@ -22,18 +22,18 @@ class Peer extends Reference: class Lobby extends Reference: - var peers : Array = [] - var host : int = -1 - var sealed : bool = false + var peers: Array = [] + var host: int = -1 + var sealed: bool = false var time = 0 - func _init(host_id : int): + func _init(host_id: int): host = host_id func join(peer_id, server) -> bool: if sealed: return false if not server.has_peer(peer_id): return false - var new_peer : WebSocketPeer = server.get_peer(peer_id) + var new_peer: WebSocketPeer = server.get_peer(peer_id) new_peer.put_packet(("I: %d\n" % (1 if peer_id == host else peer_id)).to_utf8()) for p in peers: if not server.has_peer(p): @@ -156,7 +156,7 @@ func _on_data(id): func _parse_msg(id) -> bool: var pkt_str: String = server.get_peer(id).get_packet().get_string_from_utf8() - var req = pkt_str.split('\n', true, 1) + var req = pkt_str.split("\n", true, 1) if req.size() != 2: # Invalid request size return false @@ -181,11 +181,11 @@ func _parse_msg(id) -> bool: # Client is sealing the room return lobby.seal(id, server) - var dest_str : String = type.substr(3, type.length() - 3) + var dest_str: String = type.substr(3, type.length() - 3) if not dest_str.is_valid_integer(): # Destination id is not an integer return false - var dest_id : int = int(dest_str) + var dest_id: int = int(dest_str) if dest_id == NetworkedMultiplayerPeer.TARGET_PEER_SERVER: dest_id = lobby.host diff --git a/plugins/addons/material_creator/material_creator.gd b/plugins/addons/material_creator/material_creator.gd index 173b387b..1a28f08e 100644 --- a/plugins/addons/material_creator/material_creator.gd +++ b/plugins/addons/material_creator/material_creator.gd @@ -31,7 +31,7 @@ func apply_pressed(): printerr("Material Creator: Can't apply the material, because there are no nodes selected!") var material = _silly_resource_from_values().make_material() - # Go through the selected nodes and see if they have the 'set_surface_material' + # Go through the selected nodes and see if they have the "set_surface_material" # function (which only MeshInstance has by default). If they do, then set the material # to the silly material. for node in selected_nodes: