diff --git a/media/image/circle.png b/media/image/circle.png new file mode 100644 index 0000000..b65d325 Binary files /dev/null and b/media/image/circle.png differ diff --git a/media/image/keys.png b/media/image/keys.png new file mode 100644 index 0000000..d578021 Binary files /dev/null and b/media/image/keys.png differ diff --git a/src/actor/Note.gd b/src/actor/Note.gd index d6fea38..062c386 100644 --- a/src/actor/Note.gd +++ b/src/actor/Note.gd @@ -12,8 +12,8 @@ export var palette : PoolColorArray func _ready(): if Engine.editor_hint: return - if Shared.notes.has(Shared.current_map): - modulate = palette[1] + var col = 0 if Shared.notes.has(Shared.current_map) else ((randi() % (palette.size() - 1)) + 1) + modulate = palette[col] func _physics_process(delta): if Engine.editor_hint: return diff --git a/src/actor/Note.tscn b/src/actor/Note.tscn index a5efa65..a485754 100644 --- a/src/actor/Note.tscn +++ b/src/actor/Note.tscn @@ -4,14 +4,13 @@ [ext_resource path="res://media/image/note.png" type="Texture" id=2] [node name="Note" type="Node2D"] -modulate = Color( 1, 0.945098, 0.909804, 1 ) z_index = 10 z_as_relative = false script = ExtResource( 1 ) hitbox_x = 10 hitbox_y = 10 tag = "note" -palette = PoolColorArray( 1, 0.945098, 0.909804, 1, 0.113725, 0.168627, 0.32549, 1 ) +palette = PoolColorArray( 0.513726, 0.462745, 0.611765, 1, 1, 0.92549, 0.152941, 1, 1, 0.639216, 0, 1, 0, 0.894118, 0.211765, 1, 0.160784, 0.678431, 1, 1, 1, 0.466667, 0.658824, 1, 1, 0, 0.301961, 1 ) [node name="Sprite" type="Sprite" parent="."] position = Vector2( 5, 5 ) diff --git a/src/autoload/Pause.gd b/src/autoload/Pause.gd index b379921..fe99e68 100644 --- a/src/autoload/Pause.gd +++ b/src/autoload/Pause.gd @@ -58,6 +58,7 @@ func toggle_pause(): is_paused = !is_paused menu.visible = is_paused UI.keys(is_paused, is_paused) + TouchScreen.turn_arrows(is_paused) clock = timer if is_paused: diff --git a/src/autoload/Shared.gd b/src/autoload/Shared.gd index 6ee8511..43ca0ed 100644 --- a/src/autoload/Shared.gd +++ b/src/autoload/Shared.gd @@ -74,10 +74,14 @@ func _ready(): SilentWolf.configure({ "api_key": str(api_key), "game_id": "TinyCrate", - "game_version": "1.0", + "game_version": "1.0.0", "log_level": 1}) SilentWolf.configure_scores({"open_scene_on_close": "res://scenes/MainPage.tscn"}) + +# yield(get_tree(), "idle_frame") +# SilentWolf.Players.post_player_data("player_name", {"1-1" : 23}, false) +# SilentWolf.Scores.persist_score("player_name", 1) func _physics_process(delta): # reset timer @@ -123,7 +127,7 @@ func change_map(): get_tree().change_scene(scene_path) is_level_select = scene_path == level_select_path is_in_game = scene_path.begins_with(map_path) or scene_path.begins_with(win_screen_path) - TouchScreen.pause.visible = is_in_game + #TouchScreen.pause.visible = is_in_game Pause.set_process_input(true) is_note = false UI.notes.visible = is_level_select diff --git a/src/autoload/touch_screen.gd b/src/autoload/touch_screen.gd index 925492a..2ece902 100644 --- a/src/autoload/touch_screen.gd +++ b/src/autoload/touch_screen.gd @@ -1,6 +1,12 @@ extends CanvasLayer -onready var pause : TouchScreenButton = $Control/HBoxTop/Pause/Control/Button +onready var left := $Control/HBoxLeft +onready var right := $Control/HBoxRight +onready var top := $Control/HBoxTop + +onready var arrows := [$Control/HBoxLeft/Left/Control/Sprite, $Control/HBoxLeft/Right/Control/Sprite] +onready var keys := [$Control/HBoxRight/C, $Control/HBoxRight/X] +onready var buttons := [$Control/HBoxLeft/Left/Control/Button, $Control/HBoxLeft/Right/Control/Button, $Control/HBoxRight/C/Control/Button, $Control/HBoxRight/X/Control/Button] func _ready(): connect("visibility_changed", self, "vis") @@ -10,3 +16,16 @@ func _ready(): func vis(): UI.visible = !visible + +func turn_arrows(arg := false): + var g = (PI * 0.5) if arg else 0 + arrows[0].rotation = g + arrows[1].rotation = g + PI + +func show_keys(arg_arrows := true, arg_c := true, arg_x := true, arg_pause := false, arg_passby := false): + left.visible = arg_arrows + keys[0].visible = arg_c + keys[1].visible = arg_x + top.visible = arg_pause + for i in buttons: + i.passby_press = arg_passby diff --git a/src/autoload/touch_screen.tscn b/src/autoload/touch_screen.tscn index 9d937dd..e3f5879 100644 --- a/src/autoload/touch_screen.tscn +++ b/src/autoload/touch_screen.tscn @@ -1,19 +1,31 @@ -[gd_scene load_steps=10 format=2] +[gd_scene load_steps=13 format=2] [ext_resource path="res://src/autoload/touch_screen.gd" type="Script" id=1] -[ext_resource path="res://media/font/m6x11.tres" type="DynamicFont" id=2] -[ext_resource path="res://media/font/m3x6.tres" type="DynamicFont" id=3] -[ext_resource path="res://src/autoload/touch_screen_button.gd" type="Script" id=4] +[ext_resource path="res://media/image/circle.png" type="Texture" id=2] +[ext_resource path="res://src/shader/outline2D_outer.shader" type="Shader" id=3] +[ext_resource path="res://media/font/NicoPaint-Regular.ttf" type="DynamicFontData" id=5] +[ext_resource path="res://media/image/keys.png" type="Texture" id=6] [sub_resource type="CircleShape2D" id=1] radius = 15.0 +[sub_resource type="ShaderMaterial" id=7] +shader = ExtResource( 3 ) +shader_param/line_color = Color( 0, 0, 0, 1 ) +shader_param/line_thickness = 1.0 + [sub_resource type="CircleShape2D" id=2] radius = 15.0 [sub_resource type="CircleShape2D" id=3] radius = 15.0 +[sub_resource type="DynamicFont" id=6] +outline_size = 1 +outline_color = Color( 0, 0, 0, 1 ) +extra_spacing_bottom = -4 +font_data = ExtResource( 5 ) + [sub_resource type="CircleShape2D" id=4] radius = 15.0 @@ -22,7 +34,7 @@ radius = 15.0 [node name="TouchScreen" type="CanvasLayer"] pause_mode = 2 -layer = 15 +layer = 6 script = ExtResource( 1 ) [node name="Control" type="Control" parent="."] @@ -54,19 +66,18 @@ margin_bottom = 15.0 [node name="Button" type="TouchScreenButton" parent="Control/HBoxLeft/Left/Control"] shape = SubResource( 1 ) shape_centered = false -passby_press = true action = "left" visibility_mode = 1 -[node name="Node2D" type="Node2D" parent="Control/HBoxLeft/Left/Control"] -modulate = Color( 1, 1, 1, 0.0784314 ) -script = ExtResource( 4 ) -circle_size = 12.0 +[node name="Circle" type="Sprite" parent="Control/HBoxLeft/Left/Control"] +modulate = Color( 1, 1, 1, 0.156863 ) +texture = ExtResource( 2 ) -[node name="Polygon2D" type="Polygon2D" parent="Control/HBoxLeft/Left/Control"] -scale = Vector2( 0.3, 0.3 ) -offset = Vector2( -12.5, 0 ) -polygon = PoolVector2Array( 0, 0, 25, -25, 25, 25 ) +[node name="Sprite" type="Sprite" parent="Control/HBoxLeft/Left/Control"] +modulate = Color( 1, 0.92549, 0.152941, 1 ) +material = SubResource( 7 ) +texture = ExtResource( 6 ) +offset = Vector2( -1, 0 ) [node name="Right" type="CenterContainer" parent="Control/HBoxLeft"] margin_left = 30.0 @@ -85,19 +96,19 @@ margin_bottom = 15.0 [node name="Button" type="TouchScreenButton" parent="Control/HBoxLeft/Right/Control"] shape = SubResource( 2 ) shape_centered = false -passby_press = true action = "right" visibility_mode = 1 -[node name="Node2D" type="Node2D" parent="Control/HBoxLeft/Right/Control"] -modulate = Color( 1, 1, 1, 0.0784314 ) -script = ExtResource( 4 ) -circle_size = 12.0 +[node name="Circle" type="Sprite" parent="Control/HBoxLeft/Right/Control"] +modulate = Color( 1, 1, 1, 0.156863 ) +texture = ExtResource( 2 ) -[node name="Polygon2D" type="Polygon2D" parent="Control/HBoxLeft/Right/Control"] -scale = Vector2( 0.3, 0.3 ) -offset = Vector2( 12.5, 0 ) -polygon = PoolVector2Array( 0, 0, -25, -25, -25, 25 ) +[node name="Sprite" type="Sprite" parent="Control/HBoxLeft/Right/Control"] +modulate = Color( 1, 0.92549, 0.152941, 1 ) +material = SubResource( 7 ) +rotation = -3.14159 +texture = ExtResource( 6 ) +offset = Vector2( -1, 0 ) [node name="HBoxRight" type="HBoxContainer" parent="Control"] anchor_right = 1.0 @@ -122,24 +133,24 @@ margin_bottom = 15.0 [node name="Button" type="TouchScreenButton" parent="Control/HBoxRight/C/Control"] shape = SubResource( 3 ) shape_centered = false -passby_press = true action = "action" visibility_mode = 1 -[node name="Node2D" type="Node2D" parent="Control/HBoxRight/C/Control"] -modulate = Color( 1, 1, 1, 0.0784314 ) -script = ExtResource( 4 ) -circle_size = 12.0 +[node name="Circle" type="Sprite" parent="Control/HBoxRight/C/Control"] +modulate = Color( 1, 1, 1, 0.156863 ) +texture = ExtResource( 2 ) -[node name="Label" type="Label" parent="Control/HBoxRight/C/Control"] -margin_left = -12.0 +[node name="Key" type="Label" parent="Control/HBoxRight/C/Control"] +modulate = Color( 1, 0, 0.301961, 1 ) +margin_left = -11.0 margin_top = -12.0 -margin_right = 12.0 +margin_right = 13.0 margin_bottom = 12.0 -custom_fonts/font = ExtResource( 2 ) +custom_fonts/font = SubResource( 6 ) text = "c" align = 1 valign = 1 +uppercase = true [node name="X" type="CenterContainer" parent="Control/HBoxRight"] margin_left = 178.0 @@ -158,24 +169,24 @@ margin_bottom = 15.0 [node name="Button" type="TouchScreenButton" parent="Control/HBoxRight/X/Control"] shape = SubResource( 4 ) shape_centered = false -passby_press = true action = "jump" visibility_mode = 1 -[node name="Node2D" type="Node2D" parent="Control/HBoxRight/X/Control"] -modulate = Color( 1, 1, 1, 0.0784314 ) -script = ExtResource( 4 ) -circle_size = 12.0 +[node name="Circle" type="Sprite" parent="Control/HBoxRight/X/Control"] +modulate = Color( 1, 1, 1, 0.156863 ) +texture = ExtResource( 2 ) -[node name="Label" type="Label" parent="Control/HBoxRight/X/Control"] -margin_left = -12.0 +[node name="Key" type="Label" parent="Control/HBoxRight/X/Control"] +modulate = Color( 0, 0.894118, 0.211765, 1 ) +margin_left = -11.0 margin_top = -12.0 -margin_right = 12.0 +margin_right = 13.0 margin_bottom = 12.0 -custom_fonts/font = ExtResource( 2 ) +custom_fonts/font = SubResource( 6 ) text = "x" align = 1 valign = 1 +uppercase = true [node name="HBoxTop" type="HBoxContainer" parent="Control"] anchor_right = 1.0 @@ -199,21 +210,21 @@ margin_bottom = 15.0 [node name="Button" type="TouchScreenButton" parent="Control/HBoxTop/Pause/Control"] shape = SubResource( 5 ) shape_centered = false -passby_press = true action = "pause" visibility_mode = 1 -[node name="Node2D" type="Node2D" parent="Control/HBoxTop/Pause/Control"] -modulate = Color( 1, 1, 1, 0.0784314 ) -script = ExtResource( 4 ) -circle_size = 12.0 +[node name="Circle" type="Sprite" parent="Control/HBoxTop/Pause/Control"] +modulate = Color( 1, 1, 1, 0.156863 ) +texture = ExtResource( 2 ) -[node name="Label" type="Label" parent="Control/HBoxTop/Pause/Control"] -margin_left = -12.0 -margin_top = -12.0 -margin_right = 12.0 -margin_bottom = 12.0 -custom_fonts/font = ExtResource( 3 ) -text = "pause" -align = 1 -valign = 1 +[node name="ColorRect" type="ColorRect" parent="Control/HBoxTop/Pause/Control"] +margin_left = -5.0 +margin_top = -6.0 +margin_right = -1.0 +margin_bottom = 6.0 + +[node name="ColorRect2" type="ColorRect" parent="Control/HBoxTop/Pause/Control"] +margin_left = 1.0 +margin_top = -6.0 +margin_right = 5.0 +margin_bottom = 6.0 diff --git a/src/menu/StartMenu.gd b/src/menu/StartMenu.gd index 398d5fb..12084c8 100644 --- a/src/menu/StartMenu.gd +++ b/src/menu/StartMenu.gd @@ -1,10 +1,10 @@ extends Node2D -onready var main_menu := $Control/Menu +onready var main_menu := $Control/Menu/List onready var menu_stuff := main_menu.get_children() onready var quit_menu := $Control/Quit -var cursor := 0 +var cursor := 0 setget set_cursor var menu_items := [] var main_items := ["play", "options", "credits"] var quit_items := ["yes", "no"] @@ -21,6 +21,8 @@ onready var node_audio_no : AudioStreamPlayer = $Audio/No func _ready(): switch_menu("main", true) UI.keys(true, true, false) + TouchScreen.turn_arrows(true) + TouchScreen.show_keys(true, false, true) func _input(event): if !is_input: @@ -36,8 +38,7 @@ func _input(event): var up = event.is_action_pressed("up") or event.is_action_pressed("left") var down = event.is_action_pressed("down") or event.is_action_pressed("right") if up or down: - cursor = clamp(cursor + (-1 if up else 1), 0, menu_items.size() - 1) - write_menu() + self.cursor += -1 if up else 1 node_audio_scroll.pitch_scale = 1 + rand_range(-0.2, 0.2) node_audio_scroll.play() @@ -45,8 +46,8 @@ func write_menu(): for i in menu_items.size(): menu_stuff[i].modulate = Color("ff004d") if i == cursor else Color("83769c") -func menu_select(): - match menu_items[clamp(cursor, 0, menu_items.size() - 1)].to_lower(): +func menu_select(tag : String = menu_items[cursor].to_lower()): + match tag: "play": Shared.wipe_scene(Shared.level_select_path) is_input = false @@ -72,7 +73,6 @@ func menu_select(): func switch_menu(arg, silent := false): var is_main : bool = arg == "main" - cursor = 0 if is_main else 1 quit_menu.visible = !is_main main_menu.visible = is_main menu_items = main_items if is_main else quit_items @@ -81,4 +81,13 @@ func switch_menu(arg, silent := false): if !silent: (node_audio_no if is_main else node_audio_quit).play() + self.cursor = 0 if is_main else 1 + +func find_cursor(arg := ""): + if is_input and menu_items.has(arg): + self.cursor = menu_items.find(arg) + menu_select() + +func set_cursor(arg := 0): + cursor = clamp(arg, 0, menu_items.size() - 1) write_menu() diff --git a/src/menu/StartMenu.tscn b/src/menu/StartMenu.tscn index 68fc48b..b48e542 100644 --- a/src/menu/StartMenu.tscn +++ b/src/menu/StartMenu.tscn @@ -40,6 +40,9 @@ font_data = ExtResource( 24 ) [node name="StartMenu" type="Node2D"] pause_mode = 2 script = ExtResource( 3 ) +__meta__ = { +"_edit_horizontal_guides_": [ ] +} [node name="Control" type="Control" parent="."] margin_left = -24.0 @@ -47,7 +50,11 @@ margin_top = 12.0 margin_right = 204.0 margin_bottom = 140.0 -[node name="Menu" type="VBoxContainer" parent="Control"] +[node name="Menu" type="Control" parent="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 + +[node name="List" type="VBoxContainer" parent="Control/Menu"] margin_left = 2.0 margin_top = 32.0 margin_right = 66.0 @@ -55,26 +62,26 @@ margin_bottom = 104.0 custom_constants/separation = 9 alignment = 1 -[node name="Item" type="HBoxContainer" parent="Control/Menu"] +[node name="Item" type="HBoxContainer" parent="Control/Menu/List"] margin_top = 9.0 margin_right = 64.0 margin_bottom = 21.0 rect_min_size = Vector2( 0, 12 ) custom_constants/separation = 2 -[node name="Image" type="Control" parent="Control/Menu/Item"] +[node name="Image" type="Control" parent="Control/Menu/List/Item"] margin_right = 8.0 margin_bottom = 12.0 rect_min_size = Vector2( 8, 8 ) -[node name="Sprite" type="Sprite" parent="Control/Menu/Item/Image"] +[node name="Sprite" type="Sprite" parent="Control/Menu/List/Item/Image"] position = Vector2( 0, 2 ) texture = ExtResource( 16 ) centered = false hframes = 4 vframes = 4 -[node name="Label" type="Label" parent="Control/Menu/Item"] +[node name="Label" type="Label" parent="Control/Menu/List/Item"] margin_left = 10.0 margin_top = 2.0 margin_right = 43.0 @@ -83,19 +90,19 @@ custom_fonts/font = SubResource( 3 ) text = "play" uppercase = true -[node name="Item2" type="HBoxContainer" parent="Control/Menu"] +[node name="Item2" type="HBoxContainer" parent="Control/Menu/List"] margin_top = 30.0 margin_right = 64.0 margin_bottom = 42.0 rect_min_size = Vector2( 0, 12 ) custom_constants/separation = 2 -[node name="Image" type="Control" parent="Control/Menu/Item2"] +[node name="Image" type="Control" parent="Control/Menu/List/Item2"] margin_right = 8.0 margin_bottom = 12.0 rect_min_size = Vector2( 8, 8 ) -[node name="Sprite" type="Sprite" parent="Control/Menu/Item2/Image"] +[node name="Sprite" type="Sprite" parent="Control/Menu/List/Item2/Image"] position = Vector2( 0, 2 ) texture = ExtResource( 16 ) centered = false @@ -103,7 +110,7 @@ hframes = 4 vframes = 4 frame = 1 -[node name="Label" type="Label" parent="Control/Menu/Item2"] +[node name="Label" type="Label" parent="Control/Menu/List/Item2"] margin_left = 10.0 margin_top = 2.0 margin_right = 58.0 @@ -112,19 +119,19 @@ custom_fonts/font = SubResource( 3 ) text = "option" uppercase = true -[node name="Item3" type="HBoxContainer" parent="Control/Menu"] +[node name="Item3" type="HBoxContainer" parent="Control/Menu/List"] margin_top = 51.0 margin_right = 64.0 margin_bottom = 63.0 rect_min_size = Vector2( 0, 12 ) custom_constants/separation = 2 -[node name="Image" type="Control" parent="Control/Menu/Item3"] +[node name="Image" type="Control" parent="Control/Menu/List/Item3"] margin_right = 8.0 margin_bottom = 12.0 rect_min_size = Vector2( 8, 8 ) -[node name="Sprite" type="Sprite" parent="Control/Menu/Item3/Image"] +[node name="Sprite" type="Sprite" parent="Control/Menu/List/Item3/Image"] position = Vector2( 0, 2 ) texture = ExtResource( 16 ) centered = false @@ -132,7 +139,7 @@ hframes = 4 vframes = 4 frame = 2 -[node name="Label" type="Label" parent="Control/Menu/Item3"] +[node name="Label" type="Label" parent="Control/Menu/List/Item3"] margin_left = 10.0 margin_top = 2.0 margin_right = 58.0 diff --git a/src/menu/credits.gd b/src/menu/credits.gd index d24d479..0b03696 100644 --- a/src/menu/credits.gd +++ b/src/menu/credits.gd @@ -2,6 +2,7 @@ extends Node2D func _ready(): UI.keys(false, true) + TouchScreen.show_keys(false, true, false) func _input(event): if event.is_action_pressed("action"): diff --git a/src/menu/hide_on_level_select.gd b/src/menu/hide_on_level_select.gd index 780e8d9..c4eed24 100644 --- a/src/menu/hide_on_level_select.gd +++ b/src/menu/hide_on_level_select.gd @@ -11,4 +11,5 @@ func pause(): visible = false func unpause(): - visible = true + if !TouchScreen.visible: + visible = true diff --git a/src/menu/options/OptionsMenu.gd b/src/menu/options/OptionsMenu.gd index 4e3dd98..ceb9f2c 100644 --- a/src/menu/options/OptionsMenu.gd +++ b/src/menu/options/OptionsMenu.gd @@ -9,6 +9,8 @@ onready var node_audio_scroll : AudioStreamPlayer = $AudioScroll func _ready(): select_item(0) UI.keys() + TouchScreen.turn_arrows(true) + TouchScreen.show_keys() func _input(event): var up = event.is_action_pressed("up") diff --git a/src/menu/select.gd b/src/menu/select.gd index c6c6d8f..69e6bfb 100644 --- a/src/menu/select.gd +++ b/src/menu/select.gd @@ -20,6 +20,8 @@ onready var node_audio_back : AudioStreamPlayer = $AudioBack func _ready(): Shared.is_level_select = true UI.keys() + TouchScreen.turn_arrows(false) + TouchScreen.show_keys() # make screens screen = $Control/Screen.duplicate() diff --git a/src/stage/Stage.gd b/src/stage/Stage.gd index b44fee5..463b60a 100644 --- a/src/stage/Stage.gd +++ b/src/stage/Stage.gd @@ -1,4 +1,10 @@ extends Node2D + +func _ready(): + if !Shared.is_level_select: + TouchScreen.turn_arrows(false) + TouchScreen.show_keys(true, true, true, true, true) + #class_name Stage # #var stage_name := "unnamed"