Implement note visuals update method.
This commit is contained in:
@@ -6,13 +6,36 @@ class_name HoldNote extends NoteVisual
|
||||
|
||||
var start_id: int
|
||||
var end_id: int
|
||||
var start_beat: float
|
||||
var end_beat: float
|
||||
|
||||
func reset() -> void:
|
||||
start_id = -1
|
||||
end_id = -1
|
||||
start_beat = -999.0
|
||||
end_beat = -999.0
|
||||
|
||||
func in_use() -> bool:
|
||||
return start_id >= 0 or end_id >= 0
|
||||
|
||||
func update(beat: float) -> void:
|
||||
pass
|
||||
var start_scroll: float
|
||||
if start_beat:
|
||||
start_scroll = _calculate_scroll(start_beat, beat)
|
||||
else:
|
||||
start_scroll = 999.0 # Decently up. (TODO Replace with offset_begin).
|
||||
_set_start_scroll(start_scroll)
|
||||
|
||||
var end_scroll: float
|
||||
if end_beat:
|
||||
end_scroll = _calculate_scroll(end_beat, beat)
|
||||
else:
|
||||
end_scroll = -999.0 # Decently down. (TODO Replace with offset_end).
|
||||
_set_end_scroll(end_scroll)
|
||||
|
||||
# ======== IMPLEMENTATION ======== #
|
||||
func _set_start_scroll(scroll: float) -> void:
|
||||
start.y = scroll
|
||||
|
||||
func _set_end_scroll(scroll: float) -> void:
|
||||
end.y = scroll
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
[ext_resource type="Script" uid="uid://cbsnb8bdby0d" path="res://rhythm_game/note/visual/hold/hold_note.gd" id="1_5cv34"]
|
||||
|
||||
[node name="HoldNote" type="Node2D" unique_id=320259211]
|
||||
[node name="HoldNote" type="Node2D" unique_id=320259211 node_paths=PackedStringArray("start", "end")]
|
||||
script = ExtResource("1_5cv34")
|
||||
start = NodePath("NoteStart")
|
||||
end = NodePath("NoteEnd")
|
||||
metadata/_custom_type_script = "uid://cbsnb8bdby0d"
|
||||
|
||||
[node name="NoteStart" type="Node2D" parent="." unique_id=1911676927]
|
||||
|
||||
Reference in New Issue
Block a user