mirror of
https://github.com/tonytins/dressupzack
synced 2025-06-25 08:04:43 -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
|
@ -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)
|
||||
|
|
|
@ -6,4 +6,4 @@ var Tops: Texture
|
|||
var Bottoms: Texture
|
||||
var Underwear: Texture
|
||||
var Accessory: Texture
|
||||
var IsMusicPaused: bool
|
||||
var IsMusicPaused: bool
|
||||
|
|
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
|
Loading…
Add table
Add a link
Reference in a new issue