1
0
Fork 0
mirror of https://github.com/tonytins/dressupzack synced 2025-06-25 08:04:43 -04:00

Further simplified design

- Removed a tone of bloat
- Use simple arrows to scroll through items instead of drag-and-drop
This commit is contained in:
Tony Bark 2024-01-16 08:01:06 -05:00
parent 3097f5063a
commit 6d75d04fc3
40 changed files with 1610 additions and 1161 deletions

View file

@ -1,3 +1,4 @@
@tool
extends Node2D
@onready var _eyes = $Eyes

View file

@ -1,37 +0,0 @@
# This project is licensed under the GPL-3.0 license.
# See the LICENSE file in the project root for more information.
extends TextureRect
var is_draggable = false
var is_inside_draggable = false
var body_ref
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if is_draggable:
if Input.is_action_just_pressed("click"):
global_position = get_global_mouse_position()
elif Input.is_action_just_released("click"):
is_draggable = false
var tween = get_tree().create_tween()
if is_inside_draggable:
tween.tween_property(self,"postion",body_ref.position,0.2).set_ease(Tween.EASE_OUT)
else:
tween.tween_property(self,"global_postion",body_ref.position,0.2).set_ease(Tween.EASE_OUT)
func _get_drag_data(at_position):
var preview_texture = TextureRect.new()
preview_texture.texture = texture
preview_texture.expand_mode = 1
preview_texture.size = Vector2(106, 112)
set_drag_preview(preview_texture)
return preview_texture.texture
func _can_drop_data(at_position, data):
return data is Texture2D
func _drop_data(at_position, data):
texture = data

23
scripts/game.gd Normal file
View file

@ -0,0 +1,23 @@
extends Node
@onready var tops = $Tops
@onready var bottoms = $Bottoms
func _on_tops_fwd_btn_pressed():
var current_frame = tops.get_frame()
tops.frame = current_frame + 1;
func _on_tops_bck_btn_pressed():
var current_frame = tops.get_frame()
tops.frame = current_frame + -1;
func _on_bottoms_bck_btn_pressed():
var current_frame = bottoms.get_frame()
bottoms.frame = current_frame + -1;
func _on_bottoms_fwd_btn_pressed():
var current_frame = bottoms.get_frame()
bottoms.frame = current_frame + 1;

View file

@ -1,3 +0,0 @@
# This project is licensed under the GPL-3.0 license.
# See the LICENSE file in the project root for more information.
extends Control

View file

@ -1,61 +0,0 @@
# This project is licensed under the GPL-3.0 license.
# See the LICENSE file in the project root for more information.
@tool
extends Node2D
@export var group: String = "dropable"
@export var texture: Texture2D
var is_draggable = false
var is_inside_dropable = false
var body_ref
var offset: Vector2
@onready var sprite = $Sprite2D
@onready var collsion = $Area2D/CollisionShape2D
func _ready():
sprite.texture = texture
collsion.position = sprite.position
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if is_draggable:
if Input.is_action_just_pressed("click"):
offset = global_position - get_global_mouse_position()
Global.is_dragging = true
if Input.is_action_pressed("click"):
global_position = get_global_mouse_position() - offset
elif Input.is_action_just_released("click"):
Global.is_dragging = false
var tween = get_tree().create_tween()
if is_inside_dropable:
tween.tween_property(self, "position", body_ref.position, 0.2).set_ease(Tween.EASE_OUT)
else:
tween.tween_property(self, "global_position", body_ref.position, 0.2).set_ease(Tween.EASE_OUT)
func _on_area_2d_body_entered(body):
if body.is_in_group(group):
is_inside_dropable = true
body.modulate = Color(Color.REBECCA_PURPLE, 1)
scale = Vector2(1.05, 1.05)
body_ref = body
func _on_area_2d_body_exited(body:StaticBody2D):
if body.is_in_group(group):
is_inside_dropable = false
body.modulate = Color(Color.MEDIUM_PURPLE, .7)
scale = Vector2(1.05, 1.05)
func _on_area_2d_mouse_entered():
if not Global.is_dragging:
is_draggable = true
scale = Vector2(1.05, 1.05)
func _on_area_2d_mouse_exited():
if not Global.is_dragging:
is_draggable = false
scale = Vector2(1, 1)

View file

@ -1,12 +0,0 @@
# This project is licensed under the GPL-3.0 license.
# See the LICENSE file in the project root for more information.
extends StaticBody2D
func _ready():
modulate = Color(Color.MEDIUM_PURPLE, 0.7)
func _process(delta):
if Global.is_dragging:
visible = true
else:
visible = false