mirror of
https://github.com/tonytins/dressupzack
synced 2025-05-05 21:34:49 -04:00
WIP decoupling clothing buttons
Couldn't think of a better title. Anyway, the current system is repeitive and redundent. While it works, it's not by means ideal. Because you have to manually write in a new condiation for every new clothing added. What makes it redundant is the fact that every clothing functions exactly the same. The only difference is in the layers it uses.
This commit is contained in:
parent
bfd678a1de
commit
721e2ab858
24 changed files with 132 additions and 84 deletions
Binary file not shown.
Binary file not shown.
|
@ -8,9 +8,14 @@
|
|||
|
||||
config_version=4
|
||||
|
||||
_global_script_classes=[ ]
|
||||
_global_script_classes=[ {
|
||||
"base": "Resource",
|
||||
"class": "Character",
|
||||
"language": "GDScript",
|
||||
"path": "res://scripts/character.gd"
|
||||
} ]
|
||||
_global_script_class_icons={
|
||||
|
||||
"Character": ""
|
||||
}
|
||||
|
||||
[application]
|
||||
|
@ -45,7 +50,7 @@ window/stretch/aspect="keep"
|
|||
|
||||
[gui]
|
||||
|
||||
theme/custom="res://styles/Game.theme"
|
||||
theme/custom="res://resources/Game.theme"
|
||||
theme/custom_font="res://fonts/montserrat_extra_bold_16.tres"
|
||||
|
||||
[importer_defaults]
|
||||
|
|
BIN
resources/Game.theme
Normal file
BIN
resources/Game.theme
Normal file
Binary file not shown.
6
resources/character.tres
Normal file
6
resources/character.tres
Normal file
|
@ -0,0 +1,6 @@
|
|||
[gd_resource type="Resource" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://scripts/character.gd" type="Script" id=1]
|
||||
|
||||
[resource]
|
||||
script = ExtResource( 1 )
|
|
@ -1,5 +1,6 @@
|
|||
[gd_scene load_steps=23 format=2]
|
||||
|
||||
[ext_resource path="res://scenes/clothing/camera.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://sprites/clothes/jeans.svg" type="Texture" id=3]
|
||||
[ext_resource path="res://sprites/clothes/blue_skirt.svg" type="Texture" id=4]
|
||||
[ext_resource path="res://sprites/clothes/sweat_pants.svg" type="Texture" id=5]
|
||||
|
@ -21,7 +22,6 @@
|
|||
[ext_resource path="res://sprites/clothes/briefs.svg" type="Texture" id=21]
|
||||
[ext_resource path="res://sprites/clothes/z_briefs.svg" type="Texture" id=22]
|
||||
[ext_resource path="res://sprites/clothes/fundosi.svg" type="Texture" id=23]
|
||||
[ext_resource path="res://sprites/clothes/camera.png" type="Texture" id=24]
|
||||
|
||||
[node name="Wordrobe" type="TabContainer"]
|
||||
anchor_right = 1.0
|
||||
|
@ -36,10 +36,10 @@ __meta__ = {
|
|||
[node name="Pants" type="Tabs" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 5.0
|
||||
margin_top = 41.0
|
||||
margin_right = -5.0
|
||||
margin_bottom = -10.0
|
||||
margin_left = 4.0
|
||||
margin_top = 39.0
|
||||
margin_right = -4.0
|
||||
margin_bottom = -4.0
|
||||
custom_constants/hseparation = 0
|
||||
|
||||
[node name="PantsScroll" type="ScrollContainer" parent="Pants"]
|
||||
|
@ -50,7 +50,7 @@ __meta__ = {
|
|||
}
|
||||
|
||||
[node name="PantsGrid" type="GridContainer" parent="Pants/PantsScroll"]
|
||||
margin_right = 790.0
|
||||
margin_right = 792.0
|
||||
margin_bottom = 228.0
|
||||
size_flags_horizontal = 3
|
||||
columns = 4
|
||||
|
@ -103,10 +103,10 @@ texture_normal = ExtResource( 9 )
|
|||
visible = false
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 5.0
|
||||
margin_top = 41.0
|
||||
margin_right = -5.0
|
||||
margin_bottom = -10.0
|
||||
margin_left = 4.0
|
||||
margin_top = 39.0
|
||||
margin_right = -4.0
|
||||
margin_bottom = -4.0
|
||||
|
||||
[node name="ShirtsScroll" type="ScrollContainer" parent="Shirts"]
|
||||
anchor_right = 1.0
|
||||
|
@ -115,8 +115,8 @@ margin_left = 10.0
|
|||
margin_top = 10.0
|
||||
|
||||
[node name="ShirtsGrid" type="GridContainer" parent="Shirts/ShirtsScroll"]
|
||||
margin_right = 780.0
|
||||
margin_bottom = 365.0
|
||||
margin_right = 782.0
|
||||
margin_bottom = 356.0
|
||||
size_flags_horizontal = 3
|
||||
columns = 4
|
||||
|
||||
|
@ -200,17 +200,17 @@ flat = true
|
|||
visible = false
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 5.0
|
||||
margin_top = 41.0
|
||||
margin_right = -5.0
|
||||
margin_bottom = -10.0
|
||||
margin_left = 4.0
|
||||
margin_top = 39.0
|
||||
margin_right = -4.0
|
||||
margin_bottom = -4.0
|
||||
|
||||
[node name="UndiesScroll" type="ScrollContainer" parent="Underwear"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
|
||||
[node name="UndiesGrid" type="GridContainer" parent="Underwear/UndiesScroll"]
|
||||
margin_right = 790.0
|
||||
margin_right = 792.0
|
||||
margin_bottom = 228.0
|
||||
size_flags_horizontal = 3
|
||||
columns = 3
|
||||
|
@ -242,10 +242,10 @@ texture_normal = ExtResource( 23 )
|
|||
visible = false
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 5.0
|
||||
margin_top = 41.0
|
||||
margin_right = -5.0
|
||||
margin_bottom = -10.0
|
||||
margin_left = 4.0
|
||||
margin_top = 39.0
|
||||
margin_right = -4.0
|
||||
margin_bottom = -4.0
|
||||
|
||||
[node name="AccsScroll" type="ScrollContainer" parent="Accessoires"]
|
||||
margin_left = 19.0
|
||||
|
@ -255,23 +255,7 @@ margin_bottom = 494.0
|
|||
|
||||
[node name="AccsGrid" type="GridContainer" parent="Accessoires/AccsScroll"]
|
||||
margin_right = 350.0
|
||||
margin_bottom = 127.0
|
||||
size_flags_horizontal = 3
|
||||
columns = 3
|
||||
|
||||
[node name="CanonCam" type="TextureButton" parent="Accessoires/AccsScroll/AccsGrid"]
|
||||
margin_right = 85.0
|
||||
margin_bottom = 112.0
|
||||
texture_normal = ExtResource( 24 )
|
||||
|
||||
[node name="RemoveAccessory" type="Button" parent="Accessoires/AccsScroll/AccsGrid"]
|
||||
margin_left = 89.0
|
||||
margin_right = 195.0
|
||||
margin_bottom = 112.0
|
||||
rect_min_size = Vector2( 85, 105 )
|
||||
custom_colors/font_color_disabled = Color( 0, 0, 0, 1 )
|
||||
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
||||
custom_colors/font_color_hover = Color( 0, 0, 0, 1 )
|
||||
custom_colors/font_color_pressed = Color( 0, 0, 0, 1 )
|
||||
icon = ExtResource( 9 )
|
||||
flat = true
|
||||
[node name="accessoryBase" parent="Accessoires/AccsScroll/AccsGrid" instance=ExtResource( 1 )]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=30 format=2]
|
||||
|
||||
[ext_resource path="res://scripts/Character.gd" type="Script" id=1]
|
||||
[ext_resource path="res://scripts/characterBase.gd" type="Script" id=1]
|
||||
[ext_resource path="res://sprites/character/tail/tail0.svg" type="Texture" id=2]
|
||||
[ext_resource path="res://sprites/character/tail/tail1.svg" type="Texture" id=3]
|
||||
[ext_resource path="res://sprites/character/tail/tail2.svg" type="Texture" id=4]
|
||||
|
@ -27,9 +27,6 @@
|
|||
[ext_resource path="res://sprites/clothes/bottoms_placeholder.png" type="Texture" id=25]
|
||||
[ext_resource path="res://sprites/clothes/tops_placeholder.png" type="Texture" id=26]
|
||||
|
||||
|
||||
|
||||
|
||||
[sub_resource type="SpriteFrames" id=1]
|
||||
animations = [ {
|
||||
"frames": [ ExtResource( 2 ), ExtResource( 2 ), ExtResource( 2 ), ExtResource( 3 ), ExtResource( 3 ), ExtResource( 3 ), ExtResource( 4 ), ExtResource( 4 ), ExtResource( 4 ) ],
|
||||
|
@ -54,7 +51,7 @@ animations = [ {
|
|||
"speed": 10.0
|
||||
} ]
|
||||
|
||||
[node name="Character" type="Node2D"]
|
||||
[node name="characterBase" type="Node2D"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Base" type="Node2D" parent="."]
|
||||
|
@ -62,7 +59,7 @@ script = ExtResource( 1 )
|
|||
[node name="Tail" type="AnimatedSprite" parent="Base"]
|
||||
position = Vector2( 54.4027, 184.439 )
|
||||
frames = SubResource( 1 )
|
||||
frame = 7
|
||||
frame = 3
|
||||
playing = true
|
||||
|
||||
[node name="Tony" type="Sprite" parent="Base"]
|
||||
|
@ -72,13 +69,13 @@ texture = ExtResource( 5 )
|
|||
[node name="Eyes" type="AnimatedSprite" parent="Base"]
|
||||
position = Vector2( 114.227, 63.9224 )
|
||||
frames = SubResource( 2 )
|
||||
frame = 1
|
||||
frame = 18
|
||||
playing = true
|
||||
|
||||
[node name="Mouth" type="AnimatedSprite" parent="Base"]
|
||||
position = Vector2( 131.024, 67.4964 )
|
||||
frames = SubResource( 3 )
|
||||
frame = 11
|
||||
frame = 7
|
||||
playing = true
|
||||
|
||||
[node name="Undies" type="Sprite" parent="."]
|
8
scenes/clothing/accessoryBase.tscn
Normal file
8
scenes/clothing/accessoryBase.tscn
Normal file
|
@ -0,0 +1,8 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://scenes/clothing/baseClothing.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://scripts/accessoryBase.gd" type="Script" id=2]
|
||||
|
||||
[node name="accessoryBase" instance=ExtResource( 1 )]
|
||||
script = ExtResource( 2 )
|
||||
[connection signal="pressed" from="clothing" to="." method="_on_accessory_pressed"]
|
15
scenes/clothing/baseClothing.tscn
Normal file
15
scenes/clothing/baseClothing.tscn
Normal file
|
@ -0,0 +1,15 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://scripts/baseClothing.gd" type="Script" id=1]
|
||||
|
||||
[node name="baseClothing" type="Control"]
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="clothing" type="TextureButton" parent="."]
|
||||
rect_min_size = Vector2( 106, 112 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
10
scenes/clothing/camera.tscn
Normal file
10
scenes/clothing/camera.tscn
Normal file
|
@ -0,0 +1,10 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://scenes/clothing/accessoryBase.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://sprites/clothes/camera.png" type="Texture" id=2]
|
||||
|
||||
[node name="accessoryBase" instance=ExtResource( 1 )]
|
||||
|
||||
[node name="clothing" parent="." index="0"]
|
||||
rect_min_size = Vector2( 106, 112 )
|
||||
texture_normal = ExtResource( 2 )
|
8
scenes/clothing/undiesBase.tscn
Normal file
8
scenes/clothing/undiesBase.tscn
Normal file
|
@ -0,0 +1,8 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://scenes/clothing/baseClothing.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://scripts/undiesBase.gd" type="Script" id=2]
|
||||
|
||||
[node name="baseClothing" instance=ExtResource( 1 )]
|
||||
script = ExtResource( 2 )
|
||||
[connection signal="pressed" from="clothing" to="." method="_on_undies_pressed"]
|
|
@ -1,14 +1,12 @@
|
|||
[gd_scene load_steps=7 format=2]
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://scripts/GameScn.gd" type="Script" id=1]
|
||||
[ext_resource path="res://scenes/characterBase.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://scenes/pause.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://scenes/character.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://scenes/clothes.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://sprites/clothes/icrazy_frame.svg" type="Texture" id=5]
|
||||
[ext_resource path="res://sprites/clothes/lights.png" type="Texture" id=6]
|
||||
|
||||
[node name="GameScreen" type="Node2D"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="PicFrame" type="Sprite" parent="."]
|
||||
position = Vector2( 163.773, 119.752 )
|
||||
|
@ -21,8 +19,8 @@ __meta__ = {
|
|||
position = Vector2( 35.118, -14.56 )
|
||||
texture = ExtResource( 6 )
|
||||
|
||||
[node name="Character" parent="." instance=ExtResource( 3 )]
|
||||
position = Vector2( 61.8154, 246.831 )
|
||||
[node name="characterBase" parent="." instance=ExtResource( 1 )]
|
||||
position = Vector2( 43, 250 )
|
||||
|
||||
[node name="UI" type="CanvasLayer" parent="."]
|
||||
|
||||
|
|
|
@ -1,15 +1,7 @@
|
|||
# Anthony Wilcox licenses this file to you under the MPL license.
|
||||
# See the LICENSE file in the project root for more information.
|
||||
extends Node2D
|
||||
extends Resource
|
||||
class_name Character
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
#func _process(delta):
|
||||
# pass
|
||||
var top = null
|
||||
var bottom = null
|
||||
var underwear = null
|
||||
var accessory = null
|
||||
|
|
|
@ -16,7 +16,6 @@ onready var accessories_placeholder = load("res://sprites/clothes/tops_placehold
|
|||
|
||||
onready var bottoms = $Character/Bottom
|
||||
onready var tops = $Character/Top
|
||||
onready var accessory = $Character/Accessory
|
||||
|
||||
# var UndiesBtn = load("res://scenes/Clothing.tscenes")
|
||||
#
|
||||
|
@ -50,15 +49,15 @@ func change_tops(new_top):
|
|||
tops.texture = tops_placeholder
|
||||
UserSettings.Tops = tops_placeholder
|
||||
|
||||
func change_accessoires(new_accessory):
|
||||
accessories_placeholder = new_accessory
|
||||
|
||||
if new_accessory == null:
|
||||
accessory.texture = accessories_placeholder
|
||||
UserSettings.Accessory = accessories_placeholder
|
||||
|
||||
accessory.texture = accessories_placeholder
|
||||
UserSettings.Accessory = accessories_placeholder
|
||||
#func change_accessoires(new_accessory):
|
||||
# accessories_placeholder = new_accessory
|
||||
#
|
||||
# if new_accessory == null:
|
||||
# accessory.texture = accessories_placeholder
|
||||
# UserSettings.Accessory = accessories_placeholder
|
||||
#
|
||||
# accessory.texture = accessories_placeholder
|
||||
# UserSettings.Accessory = accessories_placeholder
|
||||
|
||||
#func init_underwear():
|
||||
# var undiesFile = File.new()
|
||||
|
@ -76,8 +75,8 @@ func _process(delta):
|
|||
# Change clothes
|
||||
# ===========================================================
|
||||
|
||||
if $UI/Base/Wordrobe/Accessoires/AccsScroll/AccsGrid/CanonCam.is_pressed():
|
||||
change_accessoires(load("res://sprites/clothes/camera.png"))
|
||||
# if $UI/Base/Wordrobe/Accessoires/AccsScroll/AccsGrid/CanonCam.is_pressed():
|
||||
# change_accessoires(load("res://sprites/clothes/camera.png"))
|
||||
|
||||
if $UI/Base/Wordrobe/Pants/PantsScroll/PantsGrid/Jeans.is_pressed():
|
||||
change_bottoms(load("res://sprites/clothes/jeans.svg"))
|
||||
|
@ -144,8 +143,8 @@ func _process(delta):
|
|||
# Remove clothes
|
||||
# ===========================================================
|
||||
|
||||
if $UI/Base/Wordrobe/Accessoires/AccsScroll/AccsGrid/RemoveAccessory.is_pressed():
|
||||
change_accessoires(null)
|
||||
# if $UI/Base/Wordrobe/Accessoires/AccsScroll/AccsGrid/RemoveAccessory.is_pressed():
|
||||
# change_accessoires(null)
|
||||
|
||||
if $UI/Base/Wordrobe/Shirts/ShirtsScroll/ShirtsGrid/RemoveShirt.is_pressed():
|
||||
change_tops(null)
|
||||
|
|
7
scripts/accessoryBase.gd
Normal file
7
scripts/accessoryBase.gd
Normal file
|
@ -0,0 +1,7 @@
|
|||
extends "res://scripts/baseClothing.gd"
|
||||
|
||||
onready var character = preload("res://resources/character.tres")
|
||||
onready var clothing = $clothing
|
||||
|
||||
func _on_accessory_pressed():
|
||||
character.accessory = clothing.texture_normal
|
2
scripts/baseClothing.gd
Normal file
2
scripts/baseClothing.gd
Normal file
|
@ -0,0 +1,2 @@
|
|||
extends Control
|
||||
|
10
scripts/characterBase.gd
Normal file
10
scripts/characterBase.gd
Normal file
|
@ -0,0 +1,10 @@
|
|||
# Anthony Wilcox licenses this file to you under the MPL license.
|
||||
# See the LICENSE file in the project root for more information.
|
||||
extends Node2D
|
||||
|
||||
onready var character = preload("res://resources/character.tres")
|
||||
onready var accessory = $Accessory
|
||||
|
||||
func _process(delta):
|
||||
if character.accessory != null:
|
||||
accessory.texture = character.accessory
|
7
scripts/undiesBase.gd
Normal file
7
scripts/undiesBase.gd
Normal file
|
@ -0,0 +1,7 @@
|
|||
extends "res://scripts/baseClothing.gd"
|
||||
|
||||
onready var character = preload("res://resources/character.tres")
|
||||
onready var clothing = $clothing
|
||||
|
||||
func _on_undies_pressed():
|
||||
character.underwear = clothing.texture_normal
|
Binary file not shown.
Loading…
Add table
Reference in a new issue