mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-04 15:00:09 +01:00
General proofreading (#1262)
* General proofreading for grammar and spelling * General formatting * Addition of appropriate literals where appropriate, i.e. `&"foo"` for `StringName` cases and `^"foo/bar"` for `NodePath` cases
This commit is contained in:
@@ -69,17 +69,17 @@ func _process(_delta: float) -> void:
|
||||
# First, calculate the song time using data from the audio thread. This
|
||||
# value is very jittery, but will always match what the player is hearing.
|
||||
_song_time_audio = (
|
||||
player.get_playback_position()
|
||||
# The 1st beat may not start at second 0 of the audio track. Compensate
|
||||
# with an offset setting.
|
||||
- first_beat_offset_ms / 1000.0
|
||||
# For most platforms, the playback position value updates in chunks,
|
||||
# with each chunk being one "mix". Smooth this out by adding in the time
|
||||
# since the last chunk was processed.
|
||||
+ last_mix
|
||||
# Current processed audio is heard later.
|
||||
- _cached_output_latency
|
||||
)
|
||||
player.get_playback_position()
|
||||
# The 1st beat may not start at second 0 of the audio track. Compensate
|
||||
# with an offset setting.
|
||||
- first_beat_offset_ms / 1000.0
|
||||
# For most platforms, the playback position value updates in chunks,
|
||||
# with each chunk being one "mix". Smooth this out by adding in the time
|
||||
# since the last chunk was processed.
|
||||
+ last_mix
|
||||
# Current processed audio is heard later.
|
||||
- _cached_output_latency
|
||||
)
|
||||
|
||||
# Next, calculate the song time using the system clock at render rate. This
|
||||
# value is very stable, but can drift from the playing audio due to pausing,
|
||||
@@ -126,17 +126,17 @@ func play() -> void:
|
||||
|
||||
# Capture the start of the song using the system clock.
|
||||
_song_time_begin = (
|
||||
Time.get_ticks_usec() / 1000000.0
|
||||
# The 1st beat may not start at second 0 of the audio track. Compensate
|
||||
# with an offset setting.
|
||||
+ first_beat_offset_ms / 1000.0
|
||||
# Playback does not start immediately, but only when the next audio
|
||||
# chunk is processed (the "mix" step). Add in the time until that
|
||||
# happens.
|
||||
+ AudioServer.get_time_to_next_mix()
|
||||
# Add in additional output latency.
|
||||
+ _cached_output_latency
|
||||
)
|
||||
Time.get_ticks_usec() / 1000000.0
|
||||
# The 1st beat may not start at second 0 of the audio track. Compensate
|
||||
# with an offset setting.
|
||||
+ first_beat_offset_ms / 1000.0
|
||||
# Playback does not start immediately, but only when the next audio
|
||||
# chunk is processed (the "mix" step). Add in the time until that
|
||||
# happens.
|
||||
+ AudioServer.get_time_to_next_mix()
|
||||
# Add in additional output latency.
|
||||
+ _cached_output_latency
|
||||
)
|
||||
|
||||
|
||||
func stop() -> void:
|
||||
|
||||
@@ -24,9 +24,9 @@ var _hit_count: int = 0
|
||||
func _ready() -> void:
|
||||
_play_stats = PlayStats.new()
|
||||
_play_stats.changed.connect(
|
||||
func() -> void:
|
||||
play_stats_updated.emit(_play_stats)
|
||||
)
|
||||
func() -> void:
|
||||
play_stats_updated.emit(_play_stats)
|
||||
)
|
||||
|
||||
var chart_data := ChartData.get_chart_data(chart)
|
||||
|
||||
@@ -58,7 +58,7 @@ func _process(_delta: float) -> void:
|
||||
|
||||
_miss_old_notes()
|
||||
|
||||
if Input.is_action_just_pressed("main_key"):
|
||||
if Input.is_action_just_pressed(&"main_key"):
|
||||
_handle_keypress()
|
||||
|
||||
if _notes.is_empty():
|
||||
|
||||
@@ -6,16 +6,19 @@ extends Resource
|
||||
if mean_hit_error != value:
|
||||
mean_hit_error = value
|
||||
emit_changed()
|
||||
|
||||
@export var perfect_count: int = 0:
|
||||
set(value):
|
||||
if perfect_count != value:
|
||||
perfect_count = value
|
||||
emit_changed()
|
||||
|
||||
@export var good_count: int = 0:
|
||||
set(value):
|
||||
if good_count != value:
|
||||
good_count = value
|
||||
emit_changed()
|
||||
|
||||
@export var miss_count: int = 0:
|
||||
set(value):
|
||||
if miss_count != value:
|
||||
|
||||
@@ -18,12 +18,14 @@ func _init(args: Variant) -> void:
|
||||
x_filter = LowPassFilter.new()
|
||||
dx_filter = LowPassFilter.new()
|
||||
|
||||
|
||||
func alpha(rate: float, cutoff: float) -> float:
|
||||
var tau: float = 1.0 / (2 * PI * cutoff)
|
||||
var te: float = 1.0 / rate
|
||||
|
||||
return 1.0 / (1.0 + tau/te)
|
||||
|
||||
|
||||
func filter(value: float, delta: float) -> float:
|
||||
var rate: float = 1.0 / delta
|
||||
var dx: float = (value - x_filter.last_value) * rate
|
||||
@@ -32,12 +34,15 @@ func filter(value: float, delta: float) -> float:
|
||||
var cutoff: float = min_cutoff + beta * abs(edx)
|
||||
return x_filter.filter(value, alpha(rate, cutoff))
|
||||
|
||||
|
||||
class LowPassFilter:
|
||||
var last_value: float
|
||||
|
||||
|
||||
func _init() -> void:
|
||||
last_value = 0
|
||||
|
||||
|
||||
func filter(value: float, alpha: float) -> float:
|
||||
var result := alpha * value + (1 - alpha) * last_value
|
||||
last_value = result
|
||||
|
||||
@@ -4,9 +4,9 @@ var _guide_tween: Tween
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if Input.is_action_just_pressed("main_key"):
|
||||
if Input.is_action_just_pressed(&"main_key"):
|
||||
scale = 1.2 * Vector2.ONE
|
||||
if _guide_tween:
|
||||
_guide_tween.kill()
|
||||
_guide_tween = create_tween().set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_CUBIC)
|
||||
_guide_tween.tween_property(self, "scale", Vector2.ONE, 0.2)
|
||||
_guide_tween.tween_property(self, ^"scale", Vector2.ONE, 0.2)
|
||||
|
||||
@@ -42,8 +42,8 @@ func hit_perfect() -> void:
|
||||
var tween := create_tween()
|
||||
tween.set_ease(Tween.EASE_OUT)
|
||||
tween.set_trans(Tween.TRANS_QUAD)
|
||||
tween.parallel().tween_property(self, "modulate:a", 0, 0.2)
|
||||
tween.parallel().tween_property($Sprite2D, "scale", 1.5 * Vector2.ONE, 0.2)
|
||||
tween.parallel().tween_property(self, ^"modulate:a", 0, 0.2)
|
||||
tween.parallel().tween_property($Sprite2D, ^"scale", 1.5 * Vector2.ONE, 0.2)
|
||||
tween.tween_callback(queue_free)
|
||||
|
||||
|
||||
@@ -55,8 +55,8 @@ func hit_good() -> void:
|
||||
var tween := create_tween()
|
||||
tween.set_ease(Tween.EASE_OUT)
|
||||
tween.set_trans(Tween.TRANS_QUAD)
|
||||
tween.parallel().tween_property(self, "modulate:a", 0, 0.2)
|
||||
tween.parallel().tween_property($Sprite2D, "scale", 1.2 * Vector2.ONE, 0.2)
|
||||
tween.parallel().tween_property(self, ^"modulate:a", 0, 0.2)
|
||||
tween.parallel().tween_property($Sprite2D, ^"scale", 1.2 * Vector2.ONE, 0.2)
|
||||
tween.tween_callback(queue_free)
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ func miss(stop_movement: bool = true) -> void:
|
||||
modulate = Color.DARK_RED
|
||||
|
||||
var tween := create_tween()
|
||||
tween.parallel().tween_property(self, "modulate:a", 0, 0.5)
|
||||
tween.parallel().tween_property(self, ^"modulate:a", 0, 0.5)
|
||||
tween.tween_callback(queue_free)
|
||||
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ func _ready() -> void:
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if Input.is_action_just_pressed("restart"):
|
||||
if Input.is_action_just_pressed(&"restart"):
|
||||
get_tree().reload_current_scene()
|
||||
$Control/ErrorGraphVBox/CenterContainer/TimeGraph.queue_redraw()
|
||||
|
||||
@@ -112,8 +112,8 @@ func _on_note_hit(beat: float, hit_type: Enums.HitType, hit_error: float) -> voi
|
||||
_judgment_tween.kill()
|
||||
_judgment_tween = create_tween()
|
||||
_judgment_tween.tween_interval(0.2)
|
||||
_judgment_tween.tween_property($Control/JudgmentHBox/LJudgmentLabel, "modulate:a", 0, 0.5)
|
||||
_judgment_tween.parallel().tween_property($Control/JudgmentHBox/RJudgmentLabel, "modulate:a", 0, 0.5)
|
||||
_judgment_tween.tween_property($Control/JudgmentHBox/LJudgmentLabel, ^"modulate:a", 0, 0.5)
|
||||
_judgment_tween.parallel().tween_property($Control/JudgmentHBox/RJudgmentLabel, ^"modulate:a", 0, 0.5)
|
||||
|
||||
_hit_data.append(NoteHitData.new(beat, hit_type, hit_error))
|
||||
$Control/ErrorGraphVBox/CenterContainer/JudgmentsGraph.queue_redraw()
|
||||
|
||||
@@ -3,6 +3,6 @@ extends Node
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if Input.is_action_just_pressed("pause"):
|
||||
if Input.is_action_just_pressed(&"pause"):
|
||||
get_tree().paused = not get_tree().paused
|
||||
$"../Control/PauseLabel".visible = get_tree().paused
|
||||
|
||||
Reference in New Issue
Block a user