diff --git a/rhythm_game/note/visual/hold/hold_note.gd b/rhythm_game/note/visual/hold/hold_note.gd index 515f39d..8507f3c 100644 --- a/rhythm_game/note/visual/hold/hold_note.gd +++ b/rhythm_game/note/visual/hold/hold_note.gd @@ -1,4 +1,18 @@ class_name HoldNote extends NoteVisual +@export var start: Node2D + +@export var end: Node2D + var start_id: int var end_id: int + +func reset() -> void: + start_id = -1 + end_id = -1 + +func in_use() -> bool: + return start_id >= 0 or end_id >= 0 + +func update(beat: float) -> void: + pass diff --git a/rhythm_game/note/visual/hold/hold_note.tscn b/rhythm_game/note/visual/hold/hold_note.tscn index 3506fc9..fde0364 100644 --- a/rhythm_game/note/visual/hold/hold_note.tscn +++ b/rhythm_game/note/visual/hold/hold_note.tscn @@ -1,3 +1,39 @@ [gd_scene format=3 uid="uid://dq5ocf0272tet"] -[node name="HoldNote" type="Node2D" unique_id=495232990] +[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] +script = ExtResource("1_5cv34") +metadata/_custom_type_script = "uid://cbsnb8bdby0d" + +[node name="NoteStart" type="Node2D" parent="." unique_id=1911676927] + +[node name="ColorRect" type="ColorRect" parent="NoteStart" unique_id=1232591431] +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -29.0 +offset_top = -6.0 +offset_right = 29.0 +offset_bottom = 6.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(0.93, 0, 0, 1) + +[node name="NoteEnd" type="Node2D" parent="." unique_id=2007025807] + +[node name="ColorRect" type="ColorRect" parent="NoteEnd" unique_id=1179831333] +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -29.0 +offset_top = -6.0 +offset_right = 29.0 +offset_bottom = 6.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(0.93, 0, 0, 1) diff --git a/rhythm_game/note/visual/note_visual.gd b/rhythm_game/note/visual/note_visual.gd index 9feb348..5080e91 100644 --- a/rhythm_game/note/visual/note_visual.gd +++ b/rhythm_game/note/visual/note_visual.gd @@ -8,3 +8,15 @@ enum TYPE { @abstract func reset() -> void @abstract func in_use() -> bool + +@abstract func update(beat: float) -> void + +# ======= IMPLEMENTATION ======= # +var _lane: Lane = null + +func _notification(what: int) -> void: + match what: + NOTIFICATION_PARENTED: + _lane = get_parent() as Lane + NOTIFICATION_UNPARENTED: + _lane = null diff --git a/rhythm_game/note/visual/tap/tap_note.gd b/rhythm_game/note/visual/tap/tap_note.gd index a3640b0..2f3ef54 100644 --- a/rhythm_game/note/visual/tap/tap_note.gd +++ b/rhythm_game/note/visual/tap/tap_note.gd @@ -2,8 +2,13 @@ class_name TapNote extends NoteVisual var id: int = -1 +#TODO: Add all the members needed so a note can be updated. + func reset() -> void: id = -1 func in_use() -> bool: return id >= 0 + +func update(beat: float) -> void: + pass