fixed creator saving a new file when backing out, back now only updates existing saves! + save_clock resets on load (: clean up touch_screen !

This commit is contained in:
Harmony Honey 2024-02-29 22:53:34 -05:00
parent 7e8eea458e
commit 233775f4d4
5 changed files with 38 additions and 185 deletions

View file

@ -214,7 +214,7 @@ func change_map():
TouchScreen.set_game(is_in_game)
if is_in_game:
TouchScreen.show_keys(true, true, true, true, true)
TouchScreen.show_keys(true, true, true, true)
UI.show_stats()
elif is_level_select:
@ -356,6 +356,7 @@ func load_save(_slot = save_slot, is_reload := false):
username = generate_username()
player_colors = pick_player_colors()
save_maps = {}
save_clock = 0.0
var dict := {}
if is_reload: dict = save_data[_slot]

View file

@ -1,10 +1,10 @@
extends CanvasLayer
onready var left := $Control/HBoxLeft
onready var left := $Control/HBoxRight
onready var top := $Control/HBoxTop
onready var keys := [$Control/HBoxLeft/C, $Control/HBoxLeft/X]
onready var buttons := [$Control/HBoxLeft/C/Control/Button, $Control/HBoxLeft/X/Control/Button, $Control/HBoxLeft/Up/Control/Button, $Control/HBoxLeft/Down/Control/Button, $Control/HBoxLeft/Left/Control/Button, $Control/HBoxLeft/Right/Control/Button]
onready var keys := [$Control/HBoxRight/C, $Control/HBoxRight/X]
onready var buttons := [$Control/HBoxRight/C/Control/Button, $Control/HBoxRight/X/Control/Button]
onready var joystick := $Control/Joystick
func _ready():
@ -21,12 +21,12 @@ func show_keys(arg_arrows := true, arg_c := true, arg_x := true, arg_pause := fa
keys[0].visible = arg_c
keys[1].visible = arg_x
top.visible = arg_pause
for i in buttons:
i.passby_press = arg_passby
func set_game(arg := false):
var i = "" if arg else "ui_"
joystick.set_actions(i + "up", i + "down", i + "left", i + "right")
buttons[0].action = "action" if arg else "ui_no"
buttons[1].action = "jump" if arg else "ui_yes"
for f in buttons:
f.passby_press = arg

View file

@ -1,25 +1,12 @@
[gd_scene load_steps=16 format=2]
[gd_scene load_steps=11 format=2]
[ext_resource path="res://src/autoload/touch_screen.gd" type="Script" id=1]
[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://src/menu/joystick.gd" type="Script" id=4]
[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]
[ext_resource path="res://media/image/diamond16.png" type="Texture" id=7]
[ext_resource path="res://src/circle.gd" type="Script" id=8]
[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
@ -48,140 +35,13 @@ margin_top = 5.0
margin_right = -10.0
margin_bottom = -5.0
[node name="HBoxLeft" type="HBoxContainer" parent="Control"]
[node name="HBoxRight" type="HBoxContainer" parent="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
custom_constants/separation = 0
alignment = 2
[node name="Up" type="CenterContainer" parent="Control/HBoxLeft"]
visible = false
margin_top = 88.0
margin_right = 30.0
margin_bottom = 118.0
rect_min_size = Vector2( 30, 30 )
size_flags_vertical = 8
[node name="Control" type="Control" parent="Control/HBoxLeft/Up"]
margin_left = 15.0
margin_top = 15.0
margin_right = 15.0
margin_bottom = 15.0
[node name="Button" type="TouchScreenButton" parent="Control/HBoxLeft/Up/Control"]
shape = SubResource( 1 )
shape_centered = false
action = "ui_up"
visibility_mode = 1
[node name="Circle" type="Sprite" parent="Control/HBoxLeft/Up/Control"]
modulate = Color( 1, 1, 1, 0.156863 )
texture = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="Control/HBoxLeft/Up/Control"]
modulate = Color( 1, 0.92549, 0.152941, 1 )
material = SubResource( 7 )
rotation = 1.5708
texture = ExtResource( 6 )
offset = Vector2( -1, 0 )
[node name="Down" type="CenterContainer" parent="Control/HBoxLeft"]
visible = false
margin_top = 88.0
margin_right = 30.0
margin_bottom = 118.0
rect_min_size = Vector2( 30, 30 )
size_flags_vertical = 8
[node name="Control" type="Control" parent="Control/HBoxLeft/Down"]
margin_left = 15.0
margin_top = 15.0
margin_right = 15.0
margin_bottom = 15.0
[node name="Button" type="TouchScreenButton" parent="Control/HBoxLeft/Down/Control"]
shape = SubResource( 2 )
shape_centered = false
action = "ui_down"
visibility_mode = 1
[node name="Circle" type="Sprite" parent="Control/HBoxLeft/Down/Control"]
modulate = Color( 1, 1, 1, 0.156863 )
texture = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="Control/HBoxLeft/Down/Control"]
modulate = Color( 1, 0.92549, 0.152941, 1 )
material = SubResource( 7 )
rotation = -1.5708
texture = ExtResource( 6 )
offset = Vector2( -1, 0 )
[node name="Left" type="CenterContainer" parent="Control/HBoxLeft"]
visible = false
margin_top = 88.0
margin_right = 30.0
margin_bottom = 118.0
rect_min_size = Vector2( 30, 30 )
size_flags_vertical = 8
[node name="Control" type="Control" parent="Control/HBoxLeft/Left"]
margin_left = 15.0
margin_top = 15.0
margin_right = 15.0
margin_bottom = 15.0
[node name="Button" type="TouchScreenButton" parent="Control/HBoxLeft/Left/Control"]
shape = SubResource( 1 )
shape_centered = false
action = "ui_left"
visibility_mode = 1
[node name="Circle" type="Sprite" parent="Control/HBoxLeft/Left/Control"]
modulate = Color( 1, 1, 1, 0.156863 )
texture = ExtResource( 2 )
[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"]
visible = false
margin_top = 88.0
margin_right = 30.0
margin_bottom = 118.0
rect_min_size = Vector2( 30, 30 )
size_flags_vertical = 8
[node name="Control" type="Control" parent="Control/HBoxLeft/Right"]
margin_left = 15.0
margin_top = 15.0
margin_right = 15.0
margin_bottom = 15.0
[node name="Button" type="TouchScreenButton" parent="Control/HBoxLeft/Right/Control"]
shape = SubResource( 2 )
shape_centered = false
action = "ui_right"
visibility_mode = 1
[node name="Circle" type="Sprite" parent="Control/HBoxLeft/Right/Control"]
modulate = Color( 1, 1, 1, 0.156863 )
texture = ExtResource( 2 )
[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="Spacer" type="Control" parent="Control/HBoxLeft"]
margin_right = 148.0
margin_bottom = 118.0
size_flags_horizontal = 3
[node name="C" type="CenterContainer" parent="Control/HBoxLeft"]
[node name="C" type="CenterContainer" parent="Control/HBoxRight"]
margin_left = 148.0
margin_top = 88.0
margin_right = 178.0
@ -189,23 +49,23 @@ margin_bottom = 118.0
rect_min_size = Vector2( 30, 30 )
size_flags_vertical = 8
[node name="Control" type="Control" parent="Control/HBoxLeft/C"]
[node name="Control" type="Control" parent="Control/HBoxRight/C"]
margin_left = 15.0
margin_top = 15.0
margin_right = 15.0
margin_bottom = 15.0
[node name="Button" type="TouchScreenButton" parent="Control/HBoxLeft/C/Control"]
[node name="Button" type="TouchScreenButton" parent="Control/HBoxRight/C/Control"]
shape = SubResource( 3 )
shape_centered = false
action = "ui_no"
visibility_mode = 1
[node name="Circle" type="Sprite" parent="Control/HBoxLeft/C/Control"]
[node name="Circle" type="Sprite" parent="Control/HBoxRight/C/Control"]
modulate = Color( 1, 1, 1, 0.156863 )
texture = ExtResource( 2 )
[node name="Key" type="Label" parent="Control/HBoxLeft/C/Control"]
[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
@ -217,7 +77,7 @@ align = 1
valign = 1
uppercase = true
[node name="X" type="CenterContainer" parent="Control/HBoxLeft"]
[node name="X" type="CenterContainer" parent="Control/HBoxRight"]
margin_left = 178.0
margin_top = 88.0
margin_right = 208.0
@ -225,23 +85,23 @@ margin_bottom = 118.0
rect_min_size = Vector2( 30, 30 )
size_flags_vertical = 8
[node name="Control" type="Control" parent="Control/HBoxLeft/X"]
[node name="Control" type="Control" parent="Control/HBoxRight/X"]
margin_left = 15.0
margin_top = 15.0
margin_right = 15.0
margin_bottom = 15.0
[node name="Button" type="TouchScreenButton" parent="Control/HBoxLeft/X/Control"]
[node name="Button" type="TouchScreenButton" parent="Control/HBoxRight/X/Control"]
shape = SubResource( 4 )
shape_centered = false
action = "ui_yes"
visibility_mode = 1
[node name="Circle" type="Sprite" parent="Control/HBoxLeft/X/Control"]
[node name="Circle" type="Sprite" parent="Control/HBoxRight/X/Control"]
modulate = Color( 1, 1, 1, 0.156863 )
texture = ExtResource( 2 )
[node name="Key" type="Label" parent="Control/HBoxLeft/X/Control"]
[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
@ -305,10 +165,6 @@ max_range = 30.0
dead_zone = 3.0
[node name="Base" type="Control" parent="Control/Joystick"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 4
@ -316,11 +172,22 @@ size_flags_vertical = 4
script = ExtResource( 8 )
radius = 20.0
[node name="Guide" type="Control" parent="Control/Joystick/Base"]
modulate = Color( 1, 1, 1, 0.509804 )
[node name="ColorRect" type="ColorRect" parent="Control/Joystick/Base/Guide"]
margin_left = -1.0
margin_top = -15.0
margin_right = 1.0
margin_bottom = 15.0
[node name="ColorRect2" type="ColorRect" parent="Control/Joystick/Base/Guide"]
margin_left = -15.0
margin_top = -1.0
margin_right = 15.0
margin_bottom = 1.0
[node name="Tip" type="Control" parent="Control/Joystick"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 4
@ -341,18 +208,3 @@ size_flags_horizontal = 4
size_flags_vertical = 4
texture = ExtResource( 7 )
stretch_mode = 4
[node name="Guide" type="Control" parent="Control/Joystick"]
modulate = Color( 1, 1, 1, 0.509804 )
[node name="ColorRect" type="ColorRect" parent="Control/Joystick/Guide"]
margin_left = -1.0
margin_top = -15.0
margin_right = 1.0
margin_bottom = 15.0
[node name="ColorRect2" type="ColorRect" parent="Control/Joystick/Guide"]
margin_left = -15.0
margin_top = -1.0
margin_right = 15.0
margin_bottom = 1.0

View file

@ -68,7 +68,7 @@ func _input(event):
fill_swatches(i)
elif is_no:
is_input = false
Shared.is_save = true
if !Shared.save_data[Shared.save_slot].empty(): Shared.is_save = true
Shared.wipe_scene(Shared.main_menu_path)
Audio.play("menu_scroll2", 0.8, 1.2)
elif cursor_y == clamp(cursor_y, 1, 4):

View file

@ -206,7 +206,7 @@ font_data = ExtResource( 24 )
1/shapes = [ ]
1/z_index = 0
[sub_resource type="TileSet" id=22]
[sub_resource type="TileSet" id=24]
4/name = "bricks.png 4"
4/texture = ExtResource( 18 )
4/tex_offset = Vector2( 0, 0 )
@ -838,7 +838,7 @@ tile_data = PoolIntArray( 393222, 0, 0, 393223, 0, 1, 393224, 0, 0, 393225, 0, 1
[node name="DetailTileMap" parent="Stage" instance=ExtResource( 8 )]
z_index = -11
tile_set = SubResource( 22 )
tile_set = SubResource( 24 )
tile_data = PoolIntArray( 131093, 536870916, 3, 131094, 4, 1, 131095, 4, 0, 131096, 4, 3, 196624, 5, 2, 196625, 5, 0, 196626, -1610612731, 2, 196630, 536870916, 0, 196631, 4, 1, 196632, 4, 0, 262154, 536870916, 3, 262155, 536870916, 0, 262156, 4, 3, 262159, 5, 2, 262160, 5, 0, 262161, 5, 0, 262162, 5, 0, 262163, -1610612731, 2, 262166, 4, 1, 262167, 4, 0, 262168, 4, 1, 327685, 5, 2, 327686, 5, 0, 327687, 5, 0, 327688, 5, 0, 327689, 536870917, 2, 327690, 536870916, 0, 327691, 4, 1, 327692, 4, 0, 327695, -1610612731, 0, 327696, 5, 0, 327697, 5, 0, 327698, 5, 0, 327699, -1073741819, 0, 327701, 536870916, 3, 327702, 4, 0, 327703, 4, 1, 327704, 536870916, 2, 393221, -1073741819, 0, 393227, 4, 1, 393228, 4, 0, 393229, 4, 3, 393231, -1073741819, 2, 393232, 5, 0, 393233, 5, 0, 393234, 5, 0, 393235, -536870907, 2, 393237, 536870916, 0, 393238, 4, 1, 393239, 536870916, 0, 458757, -1073741819, 2, 458759, -1610612731, 2, 458762, 4, 1, 458763, 536870916, 0, 458764, 4, 1, 458765, 4, 0, 458768, -1073741819, 2, 458769, 5, 0, 458770, 1610612741, 2, 458773, 4, 2, 458774, 4, 0, 458775, 4, 1, 458776, 4, 3, 524295, -1610612731, 0, 524298, 4, 2, 524299, 4, 1, 524300, 536870916, 0, 524301, 4, 1, 524302, 4, 3, 524305, 6, 0, 524310, 4, 2, 524311, 536870916, 0, 524312, 536870916, 2, 589831, -1610612730, 0, 589832, -1610612731, 0, 589836, 4, 2, 589837, 4, 1, 589838, 4, 0, 589839, 4, 3, 589841, 6, 0, 589842, -536870907, 2, 655367, -1610612731, 0, 655373, 536870916, 3, 655374, 4, 1, 655375, 536870916, 0, 655377, 6, 0, 720901, -2147483643, 2, 720903, -536870907, 2, 720905, 5, 2, 720906, 5, 0, 720907, 5, 0, 720908, 536870917, 2, 720909, 536870916, 3, 720910, 536870916, 0, 720911, 536870916, 2, 720912, 5, 2, 720913, 6, 0, 720914, 5, 0, 720915, 536870917, 2, 720917, 5, 2, 720918, 5, 0, 720919, 536870917, 2, 786437, -2147483643, 0, 786441, -1073741819, 0, 786455, -1610612731, 0, 851973, -1073741819, 2, 851974, 1610612741, 2, 851977, 1073741829, 2, 851978, 5, 0, 851979, 1610612741, 2, 851982, 4, 1, 851983, 4, 0, 851987, 1073741829, 2, 851988, 5, 0, 851989, 6, 0, 851990, 5, 0, 851991, -536870907, 2, 917517, 536870916, 0, 917518, 4, 1, 917519, 536870916, 2, 917525, 1610612741, 2, 983053, 4, 2, 983054, 4, 0, 983055, 536870916, 2 )
[node name="GameCamera" parent="Stage" instance=ExtResource( 13 )]