diff --git a/godot.png b/godot.png deleted file mode 100644 index c98fbb6..0000000 Binary files a/godot.png and /dev/null differ diff --git a/godot.png.import b/godot.png.import deleted file mode 100644 index ca63310..0000000 --- a/godot.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://d1hpnolu3m1ho" -path="res://.godot/imported/godot.png-5e0da45ed3d6786d5794553e04f58a8c.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://godot.png" -dest_files=["res://.godot/imported/godot.png-5e0da45ed3d6786d5794553e04f58a8c.ctex"] - -[params] - -compress/mode=0 -compress/high_quality=false -compress/lossy_quality=0.7 -compress/hdr_compression=1 -compress/normal_map=0 -compress/channel_pack=0 -mipmaps/generate=false -mipmaps/limit=-1 -roughness/mode=0 -roughness/src_normal="" -process/fix_alpha_border=true -process/premult_alpha=false -process/normal_map_invert_y=false -process/hdr_as_srgb=false -process/hdr_clamp_exposure=false -process/size_limit=0 -detect_3d/compress_to=1 diff --git a/src/scenes/game.tscn b/src/scenes/game.tscn index 3401c9b..6baf51d 100644 --- a/src/scenes/game.tscn +++ b/src/scenes/game.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=15 format=3 uid="uid://cvr2aries2lhr"] +[gd_scene load_steps=16 format=3 uid="uid://cvr2aries2lhr"] [ext_resource type="Script" path="res://src/scripts/game.gd" id="1_qt3fe"] [ext_resource type="Texture2D" uid="uid://33g80p0qnfw4" path="res://src/sprites/world/background.svg" id="1_uee2i"] @@ -12,6 +12,7 @@ [ext_resource type="SystemFont" uid="uid://dfre5a3mywuhy" path="res://src/sprites/ui/comic_sans.tres" id="12_0f8fj"] [ext_resource type="Script" path="res://addons/fontawesome/FontAwesome.gd" id="12_o3hu5"] [ext_resource type="Texture2D" uid="uid://clakkue2mohs4" path="res://src/sprites/ui/greenBtn.png" id="14_yk2bu"] +[ext_resource type="StyleBox" uid="uid://cdlprci8cx4tb" path="res://src/sprites/ui/disable_button_style.tres" id="15_0xxs0"] [ext_resource type="Texture2D" uid="uid://cd8mirubbhn10" path="res://src/sprites/ui/redBtn.png" id="15_g5gd1"] [ext_resource type="Texture2D" uid="uid://wr3ns0ywb75q" path="res://src/sprites/logo.png" id="16_y58oj"] @@ -160,8 +161,9 @@ theme_override_fonts/font = ExtResource("12_0f8fj") theme_override_styles/normal = ExtResource("11_a038t") theme_override_styles/hover = ExtResource("11_a038t") theme_override_styles/pressed = ExtResource("11_a038t") -theme_override_styles/disabled = ExtResource("11_a038t") +theme_override_styles/disabled = ExtResource("15_0xxs0") theme_override_styles/focus = ExtResource("11_a038t") +disabled = true text = "Outfits" metadata/_edit_use_anchors_ = true @@ -172,7 +174,7 @@ theme_override_fonts/font = ExtResource("12_0f8fj") theme_override_styles/normal = ExtResource("11_a038t") theme_override_styles/hover = ExtResource("11_a038t") theme_override_styles/pressed = ExtResource("11_a038t") -theme_override_styles/disabled = ExtResource("11_a038t") +theme_override_styles/disabled = ExtResource("15_0xxs0") theme_override_styles/focus = ExtResource("11_a038t") text = "Seperate" metadata/_edit_use_anchors_ = true @@ -197,7 +199,7 @@ theme_override_fonts/font = ExtResource("12_0f8fj") theme_override_styles/normal = ExtResource("11_a038t") theme_override_styles/hover = ExtResource("11_a038t") theme_override_styles/pressed = ExtResource("11_a038t") -theme_override_styles/disabled = ExtResource("11_a038t") +theme_override_styles/disabled = ExtResource("15_0xxs0") theme_override_styles/focus = ExtResource("11_a038t") text = "Save" @@ -207,7 +209,7 @@ theme_override_fonts/font = ExtResource("12_0f8fj") theme_override_styles/normal = ExtResource("11_a038t") theme_override_styles/hover = ExtResource("11_a038t") theme_override_styles/pressed = ExtResource("11_a038t") -theme_override_styles/disabled = ExtResource("11_a038t") +theme_override_styles/disabled = ExtResource("15_0xxs0") theme_override_styles/focus = ExtResource("11_a038t") text = "Exit" diff --git a/src/scripts/config.gd b/src/scripts/config.gd index 9e29ca0..777beeb 100644 --- a/src/scripts/config.gd +++ b/src/scripts/config.gd @@ -25,19 +25,20 @@ func save_config(config_file = "user://config.cfg"): var default_height = ProjectSettings.get_setting(window_size + "viewport_height") # If Retina display, set a higher resolution - var screen_scale = DisplayServer.screen_get_scale(); - if screen_scale == 2: - config.set_value("window", "width", default_width * 3) - config.set_value("window", "height", default_height * 3) - else: - config.set_value("window", "width", default_width) - config.set_value("window", "height", default_height) + var display_scale = DisplayServer.screen_get_scale(); + match display_scale: + 2: + config.set_value("window", "width", default_width * display_scale + 1) + config.set_value("window", "height", default_height * display_scale + 1) + 1, _: + config.set_value("window", "width", default_width) + config.set_value("window", "height", default_height) # Save it to a file (overwrite if already exists) if !FileAccess.file_exists(config_file): config.save(config_file) -func save_game(tops = 0, bottoms = 0, full_body = 0, save_file = "user://save.cfg", overwrite = false, ): +func save_game(tops = 0, bottoms = 0, full_body = 0, save_file = "user://save.cfg", overwrite = false): # Create new ConfigFile object. var config = ConfigFile.new() diff --git a/src/scripts/game.gd b/src/scripts/game.gd index ad4c175..dd99a21 100644 --- a/src/scripts/game.gd +++ b/src/scripts/game.gd @@ -8,14 +8,23 @@ extends Node @onready var bottoms_fwd = $Canvas/UI/DressUpCtrls/BottomsFwdBtn @onready var full_body = $FullBody -var is_seperate = true -var is_full_body = false +# Only here for debugging purposes +@onready var outfits_btn = $Canvas/UI/SettingsCtrls/FullbodyBtn + +var is_seperate: bool = true +var is_full_body: bool = false +var current_frame: int +var sprite_frames: SpriteFrames var config_file = Config.config_file() var save_file = Config.save_file() func _ready(): + # Keep outfits button enabled in debug builds + if OS.is_debug_build(): + outfits_btn.disabled = false + # If config files don't exist, create them if !FileAccess.file_exists(config_file): Config.save_config(config_file) @@ -40,47 +49,49 @@ func _ready(): # Set window size DisplayServer.window_set_size(Vector2i(window_width, window_height)) - -func game_save(): +func save_all(): Config.save_game(tops.frame, bottoms.frame, full_body.frame, save_file, true) + +func next_frame(animation: AnimatedSprite2D, sprite_frames: SpriteFrames, animation_name, rewind = false): + var max_frames = sprite_frames.get_frame_count(animation_name) - 1 + current_frame = animation.frame + + if !rewind: + animation.frame = current_frame + 1 + if current_frame == max_frames: + animation.frame = 0 + else: + animation.frame = current_frame + -1 + if current_frame == 0: + animation.frame = max_frames + func _process(delta): if Input.is_action_just_pressed("exit"): - game_save() + save_all() get_tree().quit() func _on_save_btn_pressed(): - game_save() + save_all() func _on_tops_fwd_btn_pressed(): - var current_frame - - if is_seperate: - current_frame = tops.frame - tops.frame = current_frame + 1; + next_frame(tops, tops.sprite_frames, "tops") if is_full_body: - current_frame = full_body.frame - full_body.frame = current_frame + 1; + next_frame(full_body, full_body.sprite_frames, "fullbody") func _on_tops_bck_btn_pressed(): - var current_frame - if is_seperate: - current_frame = tops.frame - tops.frame = current_frame + -1; + next_frame(tops, tops.sprite_frames, "tops", true) if is_full_body: - current_frame = full_body.frame - full_body.frame = current_frame + -1; + next_frame(full_body, full_body.sprite_frames, "fullbody", true) func _on_bottoms_bck_btn_pressed(): - var current_frame = bottoms.frame - bottoms.frame = current_frame + -1; + next_frame(bottoms, bottoms.sprite_frames, "bottoms", true) func _on_bottoms_fwd_btn_pressed(): - var current_frame = bottoms.frame - bottoms.frame = current_frame + 1; + next_frame(bottoms, bottoms.sprite_frames, "bottoms") func _on_fullbody_btn_pressed(): is_seperate = false diff --git a/src/sprites/ui/disable_button_style.tres b/src/sprites/ui/disable_button_style.tres new file mode 100644 index 0000000..f9dbc2d --- /dev/null +++ b/src/sprites/ui/disable_button_style.tres @@ -0,0 +1,14 @@ +[gd_resource type="StyleBoxFlat" format=3 uid="uid://cdlprci8cx4tb"] + +[resource] +bg_color = Color(0.490196, 0.490196, 0.490196, 1) +border_width_left = 3 +border_width_top = 3 +border_width_right = 3 +border_width_bottom = 3 +border_color = Color(0.247059, 0.247059, 0.247059, 1) +border_blend = true +corner_radius_top_left = 5 +corner_radius_top_right = 5 +corner_radius_bottom_right = 5 +corner_radius_bottom_left = 5