1
0
Fork 0
mirror of https://github.com/tonytins/dressupzack synced 2025-05-06 13:44:49 -04:00

Disable import and export on the web

- Removed Kenny Pixel as default font
This commit is contained in:
Tony Bark 2021-05-31 03:08:39 -04:00
parent 230af8d840
commit 9db6589717
6 changed files with 109 additions and 58 deletions

View file

@ -39,14 +39,9 @@ window/size/width=800
window/size/height=500 window/size/height=500
window/size/resizable=false window/size/resizable=false
window/energy_saving/keep_screen_on=false window/energy_saving/keep_screen_on=false
mouse_cursor/custom_image="res://sprites/clothes/cursor.png"
window/stretch/mode="2d" window/stretch/mode="2d"
window/stretch/aspect="keep" window/stretch/aspect="keep"
[gui]
theme/custom_font="res://fonts/kenny_pixel_25.tres"
[importer_defaults] [importer_defaults]
texture={ texture={

View file

@ -30,7 +30,7 @@
[ext_resource path="res://sprites/character/mouth/mouth11.png" type="Texture" id=28] [ext_resource path="res://sprites/character/mouth/mouth11.png" type="Texture" id=28]
[ext_resource path="res://scripts/character_base.gd" type="Script" id=29] [ext_resource path="res://scripts/character_base.gd" type="Script" id=29]
[sub_resource type="SpriteFrames" id=2] [sub_resource type="SpriteFrames" id=1]
animations = [ { animations = [ {
"frames": [ ExtResource( 2 ), ExtResource( 3 ), ExtResource( 4 ) ], "frames": [ ExtResource( 2 ), ExtResource( 3 ), ExtResource( 4 ) ],
"loop": true, "loop": true,
@ -38,7 +38,7 @@ animations = [ {
"speed": 2.0 "speed": 2.0
} ] } ]
[sub_resource type="SpriteFrames" id=3] [sub_resource type="SpriteFrames" id=2]
animations = [ { animations = [ {
"frames": [ ExtResource( 6 ), ExtResource( 7 ), ExtResource( 8 ), ExtResource( 9 ), ExtResource( 10 ), ExtResource( 11 ), ExtResource( 12 ) ], "frames": [ ExtResource( 6 ), ExtResource( 7 ), ExtResource( 8 ), ExtResource( 9 ), ExtResource( 10 ), ExtResource( 11 ), ExtResource( 12 ) ],
"loop": true, "loop": true,
@ -46,7 +46,7 @@ animations = [ {
"speed": 2.0 "speed": 2.0
} ] } ]
[sub_resource type="SpriteFrames" id=4] [sub_resource type="SpriteFrames" id=3]
animations = [ { animations = [ {
"frames": [ ExtResource( 13 ), ExtResource( 14 ), ExtResource( 15 ), ExtResource( 16 ), ExtResource( 17 ), ExtResource( 18 ), ExtResource( 19 ), ExtResource( 20 ), ExtResource( 21 ), ExtResource( 22 ), ExtResource( 28 ), ExtResource( 23 ) ], "frames": [ ExtResource( 13 ), ExtResource( 14 ), ExtResource( 15 ), ExtResource( 16 ), ExtResource( 17 ), ExtResource( 18 ), ExtResource( 19 ), ExtResource( 20 ), ExtResource( 21 ), ExtResource( 22 ), ExtResource( 28 ), ExtResource( 23 ) ],
"loop": true, "loop": true,
@ -54,56 +54,97 @@ animations = [ {
"speed": 2.0 "speed": 2.0
} ] } ]
[node name="characterBase" type="Node2D"] [node name="CharacterBase" type="Node2D"]
position = Vector2( -19, -92 ) position = Vector2( -19, -92 )
script = ExtResource( 29 ) script = ExtResource( 29 )
[node name="Click" type="AudioStreamPlayer" parent="."] [node name="Click" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 24 ) stream = ExtResource( 24 )
[node name="shadow" type="Sprite" parent="."] [node name="Shadow" type="Sprite" parent="."]
position = Vector2( 4.84271, 244.714 ) position = Vector2( 4.84271, 244.714 )
texture = ExtResource( 1 ) texture = ExtResource( 1 )
[node name="body" type="Node2D" parent="."] [node name="Body" type="Node2D" parent="."]
__meta__ = { __meta__ = {
"_edit_lock_": true "_edit_lock_": true
} }
[node name="tail" type="AnimatedSprite" parent="body"] [node name="Tail" type="AnimatedSprite" parent="Body"]
position = Vector2( -33.7592, 99.4079 ) position = Vector2( -33.7592, 99.4079 )
scale = Vector2( 0.927713, 1 ) scale = Vector2( 0.927713, 1 )
frames = SubResource( 2 ) frames = SubResource( 1 )
frame = 1 frame = 2
playing = true playing = true
[node name="legs" type="Sprite" parent="body"] [node name="Legs" type="Sprite" parent="Body"]
position = Vector2( 1.47027, 191.868 ) position = Vector2( 1.47027, 191.868 )
texture = ExtResource( 5 ) texture = ExtResource( 5 )
[node name="top" type="Sprite" parent="body"] [node name="Top" type="Sprite" parent="Body"]
position = Vector2( 7, 78 ) position = Vector2( 7, 78 )
texture = ExtResource( 25 ) texture = ExtResource( 25 )
[node name="head" type="Sprite" parent="body"] [node name="Head" type="Sprite" parent="Body"]
position = Vector2( 10.6805, -25.1047 ) position = Vector2( 10.6805, -25.1047 )
texture = ExtResource( 27 ) texture = ExtResource( 27 )
[node name="eyes" type="AnimatedSprite" parent="body/head"] [node name="Eyes" type="AnimatedSprite" parent="Body/Head"]
position = Vector2( 17.6857, 4.22147 ) position = Vector2( 17.6857, 4.22147 )
frames = SubResource( 3 ) frames = SubResource( 2 )
frame = 1 frame = 2
playing = true playing = true
[node name="mouth" type="AnimatedSprite" parent="body/head"] [node name="Mouth" type="AnimatedSprite" parent="Body/Head"]
position = Vector2( 38.1195, 8.68453 ) position = Vector2( 38.1195, 8.68453 )
frames = SubResource( 4 ) frames = SubResource( 3 )
frame = 9 frame = 10
playing = true playing = true
[node name="accessory" type="Sprite" parent="body"] [node name="Accessory" type="Sprite" parent="Body"]
position = Vector2( 9.54095, 73.0832 ) position = Vector2( 9.54095, 73.0832 )
texture = ExtResource( 26 ) texture = ExtResource( 26 )
__meta__ = { __meta__ = {
"_edit_lock_": true "_edit_lock_": true
} }
[node name="Controls" type="CanvasLayer" parent="."]
[node name="Container" type="Control" parent="Controls"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = -19.0
margin_top = -92.0
margin_right = -19.0
margin_bottom = -92.0
__meta__ = {
"_edit_lock_": true,
"_edit_use_anchors_": true
}
[node name="ExportWin" type="FileDialog" parent="Controls/Container"]
anchor_left = 0.215
anchor_top = 0.21
anchor_right = 0.785
anchor_bottom = 0.79
window_title = "Export"
access = 1
current_dir = "user://Users/tonytins/Projects/tonysdressup"
current_path = "user://Users/tonytins/Projects/tonysdressup/"
__meta__ = {
"_edit_use_anchors_": true
}
[node name="ImportWin" type="FileDialog" parent="Controls/Container"]
anchor_left = 0.215
anchor_top = 0.21
anchor_right = 0.785
anchor_bottom = 0.79
window_title = "Open a File"
mode = 0
access = 1
current_dir = "user://Users/tonytins/Projects/tonysdressup"
current_path = "user://Users/tonytins/Projects/tonysdressup/"
__meta__ = {
"_edit_use_anchors_": true
}

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=13 format=2] [gd_scene load_steps=15 format=2]
[ext_resource path="res://scenes/character_base.tscn" type="PackedScene" id=1] [ext_resource path="res://scenes/character_base.tscn" type="PackedScene" id=1]
[ext_resource path="res://sprites/world/background.svg" type="Texture" id=2] [ext_resource path="res://sprites/world/background.svg" type="Texture" id=2]
@ -9,6 +9,8 @@
[ext_resource path="res://sprites/symbols/file-upload.svg" type="Texture" id=7] [ext_resource path="res://sprites/symbols/file-upload.svg" type="Texture" id=7]
[ext_resource path="res://scripts/ui.gd" type="Script" id=8] [ext_resource path="res://scripts/ui.gd" type="Script" id=8]
[ext_resource path="res://sprites/symbols/file-download.svg" type="Texture" id=9] [ext_resource path="res://sprites/symbols/file-download.svg" type="Texture" id=9]
[ext_resource path="res://sprites/symbols/file-upload-disabled.svg" type="Texture" id=10]
[ext_resource path="res://sprites/symbols/file-download-disabled.svg" type="Texture" id=11]
[ext_resource path="res://sprites/symbols/spinner.svg" type="Texture" id=12] [ext_resource path="res://sprites/symbols/spinner.svg" type="Texture" id=12]
[ext_resource path="res://scripts/spinner.gd" type="Script" id=13] [ext_resource path="res://scripts/spinner.gd" type="Script" id=13]
[ext_resource path="res://scripts/game.gd" type="Script" id=14] [ext_resource path="res://scripts/game.gd" type="Script" id=14]
@ -35,7 +37,7 @@ position = Vector2( 35.118, -14.56 )
texture = ExtResource( 6 ) texture = ExtResource( 6 )
[node name="characterBase" parent="." instance=ExtResource( 1 )] [node name="characterBase" parent="." instance=ExtResource( 1 )]
position = Vector2( 133.807, 230.615 ) position = Vector2( 141.307, 225.012 )
[node name="Controls" type="CanvasLayer" parent="."] [node name="Controls" type="CanvasLayer" parent="."]
@ -81,34 +83,33 @@ __meta__ = {
} }
[node name="ButtonCtr" type="HBoxContainer" parent="Controls/Container/CenterBtns"] [node name="ButtonCtr" type="HBoxContainer" parent="Controls/Container/CenterBtns"]
margin_left = 179.0 margin_left = 197.0
margin_top = 4.0 margin_top = 7.0
margin_right = 330.0 margin_right = 312.0
margin_bottom = 42.0 margin_bottom = 39.0
custom_constants/separation = 20 custom_constants/separation = 20
[node name="ExportBtn" type="Button" parent="Controls/Container/CenterBtns/ButtonCtr"] [node name="ExportBtn" type="TextureButton" parent="Controls/Container/CenterBtns/ButtonCtr"]
margin_right = 37.0 margin_right = 25.0
margin_bottom = 38.0 margin_bottom = 32.0
hint_tooltip = "Export" hint_tooltip = "Export"
icon = ExtResource( 7 ) texture_normal = ExtResource( 7 )
flat = true texture_disabled = ExtResource( 10 )
[node name="ImportBtn" type="Button" parent="Controls/Container/CenterBtns/ButtonCtr"] [node name="ImportBtn" type="TextureButton" parent="Controls/Container/CenterBtns/ButtonCtr"]
margin_left = 57.0 margin_left = 45.0
margin_right = 94.0 margin_right = 70.0
margin_bottom = 38.0 margin_bottom = 32.0
hint_tooltip = "Import" hint_tooltip = "Import"
icon = ExtResource( 9 ) texture_normal = ExtResource( 9 )
flat = true texture_disabled = ExtResource( 11 )
[node name="ClearBtn" type="Button" parent="Controls/Container/CenterBtns/ButtonCtr"] [node name="ClearBtn" type="TextureButton" parent="Controls/Container/CenterBtns/ButtonCtr"]
margin_left = 114.0 margin_left = 90.0
margin_right = 151.0 margin_right = 115.0
margin_bottom = 38.0 margin_bottom = 32.0
hint_tooltip = "Clear" hint_tooltip = "Clear"
icon = ExtResource( 3 ) texture_normal = ExtResource( 3 )
flat = true
[node name="versionLbl" type="Label" parent="Controls/Container"] [node name="versionLbl" type="Label" parent="Controls/Container"]
anchor_left = 0.88125 anchor_left = 0.88125

View file

@ -10,12 +10,16 @@ onready var blank_accessory = preload("res://sprites/clothes/blank_top.png")
onready var base_top = preload("res://sprites/character/character_base_top.svg") onready var base_top = preload("res://sprites/character/character_base_top.svg")
onready var base_bottom = preload("res://sprites/character/character_base_legs.svg") onready var base_bottom = preload("res://sprites/character/character_base_legs.svg")
onready var accessory = $body/accessory onready var export_win = $Controls/Container/ExportWin
onready var import_win = $Controls/Container/ImportWin
onready var unsupported_win = $Controls/Container/NotSupportedWin
onready var accessory = $Body/Accessory
#onready var underwear = $Undies #onready var underwear = $Undies
onready var bottom = $body/legs onready var bottom = $Body/Legs
onready var top = $body/top onready var top = $Body/Top
onready var eyes = $body/head/eyes # onready var eyes = $Body/Head/Eyes
onready var mouth = $body/head/mouth # onready var mouth = $Body/Head/Mouth
func _process(delta): func _process(delta):
@ -43,13 +47,16 @@ func save_game():
data_file["accessory"] = accessory.texture.resource_path data_file["accessory"] = accessory.texture.resource_path
data_file["top"] = top.texture.resource_path data_file["top"] = top.texture.resource_path
data_file["bottom"] = bottom.texture.resource_path data_file["bottom"] = bottom.texture.resource_path
var file = File.new() var file = File.new()
if file.open(_SAVE_FILE, File.WRITE) != 0: if file.open(_SAVE_FILE, File.WRITE) != 0:
print("Error opening file") print("Error opening file")
return return
var json_file = to_json(data_file) var json_file = to_json(data_file)
GameEvents.emit_signal("indicate")
file.store_line(json_file) file.store_line(json_file)
print_debug(json_file)
file.close() file.close()
func load_game(): func load_game():
@ -62,8 +69,8 @@ func load_game():
if file.open(_SAVE_FILE, File.READ) != 0: if file.open(_SAVE_FILE, File.READ) != 0:
print("Error opening file") print("Error opening file")
return return
var data = parse_json(file.get_line()) var data = parse_json(file.get_as_text())
var top_texture = ImageTexture.new() var top_texture = ImageTexture.new()
var accessory_texture = ImageTexture.new() var accessory_texture = ImageTexture.new()
@ -72,6 +79,8 @@ func load_game():
var accessory_image = Image.new() var accessory_image = Image.new()
var bottom_image = Image.new() var bottom_image = Image.new()
GameEvents.emit_signal("indicate")
top_image.load(data["top"]) top_image.load(data["top"])
top_texture.create_from_image(top_image) top_texture.create_from_image(top_image)
top.texture = top_texture top.texture = top_texture
@ -94,10 +103,8 @@ func _on_clearBtn_pressed():
func _on_SaveBtn_pressed(): func _on_SaveBtn_pressed():
$Click.play() $Click.play()
GameEvents.emit_signal("indicate")
save_game() save_game()
func _on_LoadBtn_pressed(): func _on_LoadBtn_pressed():
$Click.play() $Click.play()
GameEvents.emit_signal("indicate")
load_game() load_game()

View file

@ -1,3 +1,3 @@
# This project is licensed under the Artistic-2.0 license. # This project is licensed under the Artistic-2.0 license.
# See the LICENSE file in the project root for more information. # See the LICENSE file in the project root for more information.
extends Node2D extends Node2D

View file

@ -9,7 +9,14 @@ onready var blank_accessory = preload("res://sprites/clothes/blank_top.png")
onready var base_top = preload("res://sprites/character/character_base_top.svg") onready var base_top = preload("res://sprites/character/character_base_top.svg")
onready var base_bottom = preload("res://sprites/character/character_base_legs.svg") onready var base_bottom = preload("res://sprites/character/character_base_legs.svg")
onready var export_btn = $CenterBtns/ButtonCtr/ExportBtn
onready var import_btn = $CenterBtns/ButtonCtr/ImportBtn
func _ready(): func _ready():
var verLabel = $versionLbl var verLabel = $versionLbl
verLabel.text = "v" + version verLabel.text = "v" + version
GameData.version = version GameData.version = version
if OS.get_name() == "HTML5":
export_btn.disabled == true
import_btn.disabled == true