mirror of
https://github.com/GDQuest/godot-platformer-2d.git
synced 2026-01-23 02:14:19 +00:00
Address warnings
This commit is contained in:
parent
7d111fc991
commit
ba1df1af21
24 changed files with 37 additions and 21 deletions
|
|
@ -1,5 +1,5 @@
|
|||
# warning-ignore:unused_signal
|
||||
extends Node
|
||||
|
||||
|
||||
signal player_moved(player)
|
||||
signal checkpoint_visited(checkpoint_name)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ var is_active := true setget set_is_active
|
|||
|
||||
|
||||
func _ready() -> void:
|
||||
# warning-ignore:return_value_discarded
|
||||
connect("area_entered", self, "_on_area_entered")
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ var level: Node2D = null
|
|||
|
||||
func _ready() -> void:
|
||||
LevelLoader.setup(self, $Player, StartLevel)
|
||||
# warning-ignore:return_value_discarded
|
||||
Events.connect("checkpoint_visited", self, "_on_Events_checkpoint_visited")
|
||||
|
||||
|
||||
|
|
@ -21,6 +22,7 @@ func _on_Events_checkpoint_visited(checkpoint_name: String) -> void:
|
|||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("restart"):
|
||||
# warning-ignore:return_value_discarded
|
||||
get_tree().reload_current_scene()
|
||||
elif event.is_action_pressed("DEBUG_die"):
|
||||
var last_checkpoint_name: String = visited_checkpoints[level.name].back()
|
||||
|
|
|
|||
|
|
@ -15,15 +15,15 @@ func _ready() -> void:
|
|||
_parent = get_parent() as State
|
||||
|
||||
|
||||
func unhandled_input(event: InputEvent) -> void:
|
||||
func unhandled_input(_event: InputEvent) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func physics_process(delta: float) -> void:
|
||||
func physics_process(_delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func enter(msg: Dictionary = {}) -> void:
|
||||
func enter(_msg: Dictionary = {}) -> void:
|
||||
pass
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ var is_active := true setget set_is_active
|
|||
|
||||
|
||||
func _ready() -> void:
|
||||
# warning-ignore:return_value_discarded
|
||||
timer.connect("timeout", self, "_on_Timer_timeout")
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ export(String) var next_level_portal_name := ""
|
|||
|
||||
|
||||
func _ready() -> void:
|
||||
# warning-ignore:return_value_discarded
|
||||
connect("body_entered", self, "_on_body_entered")
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ onready var camera_position: Position2D = $CameraPosition
|
|||
|
||||
|
||||
func _ready() -> void:
|
||||
# warning-ignore:return_value_discarded
|
||||
Events.connect("player_moved", self, "_on_Events_player_moved")
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@ export var mouse_range := Vector2(100.0, 500.0)
|
|||
var is_active := true
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
func _physics_process(_delta: float) -> void:
|
||||
update_position()
|
||||
|
||||
|
||||
func update_position(velocity: Vector2 = Vector2.ZERO) -> void:
|
||||
func update_position(_velocity: Vector2 = Vector2.ZERO) -> void:
|
||||
# Updates the camera rig's position based on the player's state and controller position
|
||||
if not is_active:
|
||||
return
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ func reset_smoothing_speed() -> void:
|
|||
|
||||
|
||||
func _ready() -> void:
|
||||
# warning-ignore:return_value_discarded
|
||||
Settings.connect('controls_changed', self, 'reset_smoothing_speed')
|
||||
timer.connect('timeout', self, '_on_ShakeTimer_timeout')
|
||||
|
||||
|
|
@ -37,7 +38,7 @@ func _ready() -> void:
|
|||
set_process(false)
|
||||
|
||||
|
||||
func _process(delta) -> void:
|
||||
func _process(_delta) -> void:
|
||||
var damping = ease(timer.time_left / timer.wait_time, DAMP_EASING)
|
||||
offset = Vector2(
|
||||
rand_range(amplitude, -amplitude) * damping,
|
||||
|
|
|
|||
|
|
@ -16,9 +16,11 @@ func set_hook_position(value: Vector2) -> void:
|
|||
var to_target := hook_position - global_position
|
||||
self.length = to_target.length()
|
||||
rotation = to_target.angle()
|
||||
# warning-ignore:return_value_discarded
|
||||
tween.interpolate_property(
|
||||
self, 'length', length, start_length,
|
||||
0.25, Tween.TRANS_QUAD, Tween.EASE_OUT)
|
||||
# warning-ignore:return_value_discarded
|
||||
tween.start()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ class_name Hook, "res://assets/icons/icon_hook.svg"
|
|||
# Draws the hook's range in the editor
|
||||
|
||||
|
||||
# warning-ignore:unused_signal
|
||||
signal hooked_onto_target(target_global_position)
|
||||
|
||||
onready var ray_cast: RayCast2D = $RayCast2D
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ func _ready() -> void:
|
|||
ray_cast.set_as_toplevel(true)
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
func _physics_process(_delta: float) -> void:
|
||||
self.target = find_best_target()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ func unhandled_input(event: InputEvent) -> void:
|
|||
_state_machine.transition_to("Fire")
|
||||
|
||||
|
||||
func physics_process(delta: float) -> void:
|
||||
func physics_process(_delta: float) -> void:
|
||||
var cast: Vector2 = owner.get_aim_direction() * owner._radius
|
||||
var angle := cast.angle()
|
||||
owner.ray_cast.cast_to = cast
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ func _on_Cooldown_timeout() -> void:
|
|||
_state_machine.transition_to("Aim")
|
||||
|
||||
|
||||
func enter(msg: Dictionary = {}) -> void:
|
||||
func enter(_msg: Dictionary = {}) -> void:
|
||||
owner.is_aiming = false
|
||||
|
||||
var target: HookTarget = owner.snap_detector.target
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ extends KinematicBody2D
|
|||
class_name Player
|
||||
|
||||
|
||||
# warning-ignore:unused_signal
|
||||
signal hopped_off_entity
|
||||
|
||||
onready var state_machine: StateMachine = $StateMachine
|
||||
|
|
@ -31,7 +32,9 @@ var last_checkpoint: Area2D = null
|
|||
|
||||
|
||||
func _ready() -> void:
|
||||
# warning-ignore:return_value_discarded
|
||||
stats.connect("health_depleted", self, "_on_Player_health_depleted")
|
||||
# warning-ignore:return_value_discarded
|
||||
Events.connect("checkpoint_visited", self, "_on_Events_checkpoint_visited")
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ onready var shadow: Sprite = $Shadow
|
|||
|
||||
|
||||
func _ready() -> void:
|
||||
# warning-ignore:return_value_discarded
|
||||
anim.connect("animation_finished", self, "_on_Anim_animation_finished")
|
||||
|
||||
|
||||
|
|
@ -16,7 +17,7 @@ func _on_Anim_animation_finished(name: String) -> void:
|
|||
emit_signal("animation_finished", name)
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
func _physics_process(_delta: float) -> void:
|
||||
floor_detector.force_raycast_update()
|
||||
shadow.visible = floor_detector.is_close_to_floor()
|
||||
var ratio := floor_detector.get_floor_distance_ratio()
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ func physics_process(delta: float) -> void:
|
|||
Events.emit_signal("player_moved", owner)
|
||||
|
||||
|
||||
func enter(msg: Dictionary = {}):
|
||||
func enter(_msg: Dictionary = {}):
|
||||
owner.is_active = false
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ extends State
|
|||
var last_checkpoint: Area2D = null
|
||||
|
||||
|
||||
func _on_Player_animation_finished(anim_name: String) -> void:
|
||||
func _on_Player_animation_finished(_anim_name: String) -> void:
|
||||
_state_machine.transition_to('Spawn', {last_checkpoint = last_checkpoint})
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,13 +2,11 @@ extends State
|
|||
# Player state when grappling an enemy. Waits to let player aim/take stock, then jumps up.
|
||||
|
||||
|
||||
onready var timer: Timer = $Timer
|
||||
|
||||
export var hop_impulse := 500.0
|
||||
export var wait_duration := 0.6
|
||||
|
||||
|
||||
func enter(msg: Dictionary = {}) -> void:
|
||||
func enter(_msg: Dictionary = {}) -> void:
|
||||
owner.stats.set_invulnerable_for_seconds(wait_duration*3)
|
||||
|
||||
var timer := get_tree().create_timer(wait_duration)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ func _on_Stats_damage_taken():
|
|||
_state_machine.transition_to("Stagger")
|
||||
|
||||
|
||||
func _on_PassThrough_body_exited(body):
|
||||
func _on_PassThrough_body_exited(_body):
|
||||
if not owner.get_collision_mask_bit(PASS_THROUGH_LAYER):
|
||||
owner.set_collision_mask_bit(PASS_THROUGH_LAYER, true)
|
||||
|
||||
|
|
@ -51,10 +51,11 @@ func physics_process(delta: float) -> void:
|
|||
Events.emit_signal("player_moved", owner)
|
||||
|
||||
|
||||
func enter(msg: Dictionary = {}) -> void:
|
||||
func enter(_msg: Dictionary = {}) -> void:
|
||||
owner.hook.connect("hooked_onto_target", self, "_on_Hook_hooked_onto_target")
|
||||
owner.stats.connect("damage_taken", self, "_on_Stats_damage_taken")
|
||||
owner.pass_through.connect("body_exited", self, "_on_PassThrough_body_exited")
|
||||
# warning-ignore:return_value_discarded
|
||||
$Air.connect("jumped", $Idle.jump_delay, "start")
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -10,10 +10,12 @@ export var slow_duration_seconds := 0.4
|
|||
|
||||
|
||||
func _ready() -> void:
|
||||
# warning-ignore:return_value_discarded
|
||||
slow_starter.connect("timeout", self, "_on_SlowDown_timeout")
|
||||
|
||||
|
||||
func _on_SlowDown_timeout() -> void:
|
||||
# warning-ignore:return_value_discarded
|
||||
tween.interpolate_property(
|
||||
_parent,
|
||||
"max_speed",
|
||||
|
|
@ -23,6 +25,7 @@ func _on_SlowDown_timeout() -> void:
|
|||
Tween.TRANS_LINEAR,
|
||||
Tween.EASE_OUT
|
||||
)
|
||||
# warning-ignore:return_value_discarded
|
||||
tween.start()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ extends State
|
|||
# Takes control away from the player and makes the character spawn
|
||||
|
||||
|
||||
func _on_Player_animation_finished(anim_name: String) -> void:
|
||||
func _on_Player_animation_finished(_anim_name: String) -> void:
|
||||
_state_machine.transition_to('Move/Idle')
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ func _get_configuration_warning() -> String:
|
|||
return "" if $Duration else "%s requires a Timer child named Duration" % name
|
||||
|
||||
|
||||
func enter(msg: Dictionary = {}):
|
||||
func enter(_msg: Dictionary = {}):
|
||||
duration.start()
|
||||
yield(duration, "timeout")
|
||||
_state_machine.transition_to("Move/Idle")
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ func _ready() -> void:
|
|||
_setup()
|
||||
|
||||
|
||||
func _process(delta) -> void:
|
||||
func _process(_delta) -> void:
|
||||
_update()
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue