fix: compilation errors that were caused by the dragonproperties refactoring
This commit is contained in:
parent
46726bca32
commit
50bc814367
14 changed files with 66 additions and 207 deletions
|
@ -1,22 +0,0 @@
|
|||
extends Button
|
||||
|
||||
|
||||
@export var dragon_adder: PackedScene
|
||||
@onready var base: GameManager = $"../.."
|
||||
|
||||
|
||||
func _on_pressed() -> void:
|
||||
var adder: DragonAdder = dragon_adder.instantiate()
|
||||
adder.dragon_added.connect(_add_dragon)
|
||||
|
||||
var window_position: Vector2i = DisplayServer.window_get_position()
|
||||
var window_size: Vector2i = DisplayServer.window_get_size()
|
||||
|
||||
adder.position = window_position - adder.size / 2
|
||||
|
||||
adder.show()
|
||||
add_child(adder)
|
||||
|
||||
|
||||
func _add_dragon(dragon_name: String, hat: Texture2D, shirt: Texture2D, shoes: Texture2D):
|
||||
base.add_dragon(hat, shirt, shoes, dragon_name)
|
|
@ -1 +0,0 @@
|
|||
uid://w60u0tg1hlvu
|
|
@ -1,35 +0,0 @@
|
|||
extends Window
|
||||
class_name DragonAdder
|
||||
|
||||
|
||||
@export var hat_outfits: DragonOutfit
|
||||
@export var shirt_outfits: DragonOutfit
|
||||
@export var shoes_outfits: DragonOutfit
|
||||
|
||||
var code_generator: CodeGenerator
|
||||
|
||||
@onready var line_edit: LineEdit = $CanvasLayer/LineEdit
|
||||
|
||||
signal dragon_added(dragon_name: String, hat: Texture2D, shirt: Texture2D, shoes: Texture2D)
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
code_generator = CodeGenerator.new(hat_outfits, shirt_outfits, shoes_outfits)
|
||||
|
||||
|
||||
func _on_button_pressed() -> void:
|
||||
var dragon: Dictionary = code_generator.descrypt(line_edit.text)
|
||||
if dragon['name'] == null:
|
||||
return
|
||||
|
||||
var name: String = dragon['name']
|
||||
var hat: Texture2D = dragon['hat']
|
||||
var shirt: Texture2D = dragon['shirt']
|
||||
var shoes: Texture2D = dragon['shoes']
|
||||
|
||||
dragon_added.emit(name, hat, shirt, shoes)
|
||||
|
||||
queue_free()
|
||||
|
||||
func _on_close_requested() -> void:
|
||||
queue_free()
|
|
@ -1 +0,0 @@
|
|||
uid://b1fnwy6wnufw1
|
|
@ -1,62 +0,0 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://oqa2ry73vqjf"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b1fnwy6wnufw1" path="res://scenes/dragon_adder/dragon_adder.gd" id="1_x83p2"]
|
||||
[ext_resource type="Resource" uid="uid://cnhwn6kfcbjl5" path="res://assets/outfits/hats.tres" id="2_33u3u"]
|
||||
[ext_resource type="Script" uid="uid://mhudiyt5gnt1" path="res://scenes/dragon_editor/line_edit.gd" id="2_77mmq"]
|
||||
[ext_resource type="Resource" uid="uid://etegcak2sphs" path="res://assets/outfits/shirts.tres" id="3_xb0i6"]
|
||||
[ext_resource type="Resource" uid="uid://ba5684xylts3f" path="res://assets/outfits/shoes.tres" id="4_nf61g"]
|
||||
|
||||
[node name="DragonAdder" type="Window"]
|
||||
position = Vector2i(0, 36)
|
||||
size = Vector2i(500, 300)
|
||||
always_on_top = true
|
||||
script = ExtResource("1_x83p2")
|
||||
hat_outfits = ExtResource("2_33u3u")
|
||||
shirt_outfits = ExtResource("3_xb0i6")
|
||||
shoes_outfits = ExtResource("4_nf61g")
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="Button" type="Button" parent="CanvasLayer"]
|
||||
anchors_preset = 7
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -32.0
|
||||
offset_top = -31.0
|
||||
offset_right = 32.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
focus_mode = 0
|
||||
text = "afegeix"
|
||||
|
||||
[node name="LineEdit" type="LineEdit" parent="CanvasLayer"]
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -214.0
|
||||
offset_top = -29.0
|
||||
offset_right = 214.0
|
||||
offset_bottom = 29.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
placeholder_text = "CODI"
|
||||
alignment = 1
|
||||
max_length = 22
|
||||
script = ExtResource("2_77mmq")
|
||||
|
||||
[node name="Label" type="Label" parent="CanvasLayer"]
|
||||
anchors_preset = 5
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
offset_left = -59.5
|
||||
offset_right = 59.5
|
||||
offset_bottom = 23.0
|
||||
grow_horizontal = 2
|
||||
text = "afegeix un drac"
|
||||
|
||||
[connection signal="close_requested" from="." to="." method="_on_close_requested"]
|
||||
[connection signal="pressed" from="CanvasLayer/Button" to="." method="_on_button_pressed"]
|
|
@ -16,7 +16,7 @@ class_name DragonEditor
|
|||
|
||||
@onready var dragger: DraggableWindow = $CanvasLayer/Dragger
|
||||
|
||||
signal on_create_dragon(hat: Texture2D, shirt: Texture2D, shoes: Texture2D, dragon_name: String)
|
||||
signal on_create_dragon(properties: DragonProperties)
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
|
|
@ -8,11 +8,11 @@ class_name DragonEntity
|
|||
@export var min_exit_time: float
|
||||
@export var max_exit_time: float
|
||||
|
||||
signal on_pick(dragon_id: int, position: Vector2, hat: Texture2D, shirt: Texture2D, shoes: Texture2D)
|
||||
signal on_pick(properties: DragonProperties)
|
||||
signal on_quit(dragon_id: int)
|
||||
|
||||
var rng: RandomNumberGenerator = RandomNumberGenerator.new()
|
||||
var id: int
|
||||
var properties: DragonProperties
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
@ -22,13 +22,13 @@ func _ready() -> void:
|
|||
|
||||
func _queue_exit():
|
||||
await get_tree().create_timer(rng.randf_range(min_exit_time, max_exit_time)).timeout
|
||||
var tween = get_tree().create_tween()
|
||||
var tween: Tween = get_tree().create_tween()
|
||||
tween.tween_property($CollisionShape2D, "position", Vector2(get_window().size.x + 200, 0), animation_duration)
|
||||
tween.tween_callback(_proceed_exit)
|
||||
|
||||
|
||||
func _proceed_exit():
|
||||
on_quit.emit(id)
|
||||
on_quit.emit(properties.id)
|
||||
queue_free()
|
||||
|
||||
|
||||
|
@ -39,13 +39,14 @@ func _play_initial_animation() -> void:
|
|||
tween.tween_callback(_queue_exit)
|
||||
|
||||
|
||||
func _input_event(viewport, event, shape_idx) -> void:
|
||||
func _input_event(_viewport, event, _shape_idx) -> void:
|
||||
if event is InputEventMouseButton \
|
||||
and event.button_index == MOUSE_BUTTON_LEFT \
|
||||
and event.is_pressed():
|
||||
on_pick.emit(id, position + $CollisionShape2D.position, dragon.hat.texture, dragon.shirt.texture, dragon.shoes.texture)
|
||||
properties.position = position + $CollisionShape2D.position
|
||||
on_pick.emit(properties)
|
||||
queue_free()
|
||||
|
||||
|
||||
func dress(hat: Texture2D, shirt: Texture2D, shoes: Texture2D):
|
||||
dragon.dress(hat, shirt, shoes)
|
||||
func dress(properties: DragonProperties):
|
||||
dragon.dress(properties)
|
||||
|
|
|
@ -4,13 +4,20 @@ class_name DragonSprite
|
|||
|
||||
@export var hat: Sprite2D
|
||||
@export var shirt: Sprite2D
|
||||
@export var shoes: Sprite2D
|
||||
@export var decor: Sprite2D
|
||||
@export var color: Sprite2D
|
||||
|
||||
@export var hat_outfits: DragonOutfit
|
||||
@export var shirt_outfits: DragonOutfit
|
||||
@export var decor_outfits: DragonOutfit
|
||||
@export var color_outfits: DragonOutfit
|
||||
|
||||
|
||||
func dress(hat: Texture2D, shirt: Texture2D, shoes: Texture2D):
|
||||
self.hat.texture = hat
|
||||
self.shirt.texture = shirt
|
||||
self.shoes.texture = shoes
|
||||
func dress(properties: DragonProperties):
|
||||
self.hat.texture = hat_outfits.get_texture(properties.hat)
|
||||
self.shirt.texture = shirt_outfits.get_texture(properties.shirt)
|
||||
self.decor.texture = decor_outfits.get_texture(properties.decor)
|
||||
self.color.texture = color_outfits.get_texture(properties.color)
|
||||
|
||||
|
||||
func walk_left():
|
||||
|
|
|
@ -1,20 +1,29 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://baa8gpicw2yg0"]
|
||||
[gd_scene load_steps=12 format=3 uid="uid://baa8gpicw2yg0"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bjiap06gs02j" path="res://scenes/dragons/dragon_sprite.gd" id="1_oaoux"]
|
||||
[ext_resource type="Resource" uid="uid://cnhwn6kfcbjl5" path="res://assets/outfits/hats.tres" id="2_mxc00"]
|
||||
[ext_resource type="Texture2D" uid="uid://dl87ffgh2hl68" path="res://assets/sprites/dragons/DragonPet_drac01.png" id="2_oaoux"]
|
||||
[ext_resource type="Texture2D" uid="uid://12fv5nymaljj" path="res://assets/sprites/hats/DragonPet_barret_barretina.png" id="3_oaoux"]
|
||||
[ext_resource type="Resource" uid="uid://etegcak2sphs" path="res://assets/outfits/shirts.tres" id="3_umqeb"]
|
||||
[ext_resource type="Resource" uid="uid://ba5684xylts3f" path="res://assets/outfits/shoes.tres" id="4_7b2ll"]
|
||||
[ext_resource type="Texture2D" uid="uid://b3xnii6r00hol" path="res://assets/sprites/shirts/DragonPet_roba_traje.png" id="4_oaoux"]
|
||||
[ext_resource type="Texture2D" uid="uid://c1b8gp5uf2ehk" path="res://assets/sprites/decor/DragonPet_acc_rosa.png" id="5_stf6f"]
|
||||
[ext_resource type="Resource" uid="uid://bcs60f2k7h0jc" path="res://assets/outfits/dragons.tres" id="5_x2k4p"]
|
||||
[ext_resource type="SpriteFrames" uid="uid://4cm7picl2gvs" path="res://assets/animations/dragon_green.tres" id="6_yf7bj"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_oaoux"]
|
||||
size = Vector2(76, 88)
|
||||
|
||||
[node name="Dragon" type="Node2D" node_paths=PackedStringArray("hat", "shirt", "shoes")]
|
||||
[node name="Dragon" type="Node2D" node_paths=PackedStringArray("hat", "shirt", "decor", "color")]
|
||||
script = ExtResource("1_oaoux")
|
||||
hat = NodePath("Sprite/Hat")
|
||||
shirt = NodePath("Sprite/Shirt")
|
||||
shoes = NodePath("Sprite/Shoes")
|
||||
decor = NodePath("Sprite/Decor")
|
||||
color = NodePath("Sprite")
|
||||
hat_outfits = ExtResource("2_mxc00")
|
||||
shirt_outfits = ExtResource("3_umqeb")
|
||||
decor_outfits = ExtResource("4_7b2ll")
|
||||
color_outfits = ExtResource("5_x2k4p")
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="."]
|
||||
|
||||
|
@ -32,10 +41,11 @@ texture = ExtResource("3_oaoux")
|
|||
[node name="Shirt" type="Sprite2D" parent="Sprite"]
|
||||
texture = ExtResource("4_oaoux")
|
||||
|
||||
[node name="Shoes" type="Sprite2D" parent="Sprite"]
|
||||
[node name="Decor" type="Sprite2D" parent="Sprite"]
|
||||
texture = ExtResource("5_stf6f")
|
||||
|
||||
[node name="DragonBody" type="AnimatedSprite2D" parent="."]
|
||||
visible = false
|
||||
position = Vector2(36, 34)
|
||||
sprite_frames = ExtResource("6_yf7bj")
|
||||
animation = &"idle"
|
||||
|
|
|
@ -29,7 +29,7 @@ var rng: RandomNumberGenerator = RandomNumberGenerator.new()
|
|||
|
||||
|
||||
func _ready():
|
||||
_library = DragonLibrary.new(hat_outfits, shirt_outfits, shoes_outfits)
|
||||
_library = DragonLibrary.new()
|
||||
_instantiator = DragonInstantiator.new(dragon_template, get_viewport(), get_window())
|
||||
_save_load = SaveLoad.new()
|
||||
|
||||
|
@ -60,7 +60,7 @@ func _instantiate_random_dragon():
|
|||
# TODO: Search for dragon and if is in library or in instantiated dragons continue next iteration
|
||||
pass
|
||||
var dragon_entity: DragonEntity = _generate_entity(spot.position, dragon)
|
||||
_filled_spots[spot] = dragon_entity.id
|
||||
_filled_spots[spot] = dragon_entity.properties.id
|
||||
return
|
||||
|
||||
|
||||
|
@ -72,12 +72,8 @@ func _get_free_spot() -> Node2D:
|
|||
|
||||
|
||||
func _generate_entity(pos: Vector2, properties: DragonProperties) -> DragonEntity:
|
||||
var id: int = rng.randi()
|
||||
var hat: Texture2D = hat_outfits.get_texture(properties.hat)
|
||||
var shirt: Texture2D = shirt_outfits.get_texture(properties.shirt)
|
||||
var shoes: Texture2D = shoes_outfits.get_texture(properties.decor)
|
||||
var dragon_name: String = properties.name
|
||||
return _instantiate_dragon_ingame(pos, hat, shirt, shoes, dragon_name, id)
|
||||
properties.id = rng.randi()
|
||||
return _instantiate_dragon_ingame(pos, properties)
|
||||
|
||||
|
||||
func move_window_to_bottom_right():
|
||||
|
@ -94,11 +90,11 @@ func move_window_to_bottom_right():
|
|||
DisplayServer.window_set_position(new_position)
|
||||
|
||||
|
||||
func add_dragon(hat: Texture2D, shirt: Texture2D, shoes: Texture2D, dragon_name: String):
|
||||
var id: int = _library.add_dragon(dragon_name, hat, shirt, shoes)
|
||||
func add_dragon(properties: DragonProperties):
|
||||
var id: int = _library.add_dragon(properties)
|
||||
for spot in dragon_spots:
|
||||
if not _filled_spots.has(spot):
|
||||
_instantiate_dragon_ingame(spot.position, hat, shirt, shoes, dragon_name, id)
|
||||
_instantiate_dragon_ingame(spot.position, properties)
|
||||
_filled_spots[spot] = id
|
||||
break
|
||||
|
||||
|
@ -109,35 +105,31 @@ func _load_game():
|
|||
_library.add_dragons(dragons)
|
||||
for d: DragonProperties in dragons:
|
||||
if d.position != Vector2i(0, 0):
|
||||
var hat: Texture2D = hat_outfits.get_texture(d.hat)
|
||||
var shirt: Texture2D = shirt_outfits.get_texture(d.shirt)
|
||||
var shoes: Texture2D = shoes_outfits.get_texture(d.decor)
|
||||
_pick_dragon(rng.randi(), d.position, hat, shirt, shoes, false)
|
||||
_pick_dragon(d, false)
|
||||
print(_save_load.contents_to_save)
|
||||
|
||||
|
||||
func _instantiate_dragon_ingame(position: Vector2, hat: Texture2D, shirt: Texture2D, shoes: Texture2D, dragon_name: String, id: int) -> DragonEntity:
|
||||
func _instantiate_dragon_ingame(window_position: Vector2, properties: DragonProperties) -> DragonEntity:
|
||||
var dragon: DragonEntity = dragon_ingame.instantiate()
|
||||
dragon.dress(hat, shirt, shoes)
|
||||
dragon.dress(properties)
|
||||
add_child(dragon)
|
||||
dragon.id = id
|
||||
dragon.position = position
|
||||
dragon.properties = properties
|
||||
dragon.position = window_position
|
||||
dragon.on_pick.connect(_pick_dragon)
|
||||
dragon.on_quit.connect(_quit_dragon)
|
||||
_instantiated_dragons[id] = dragon
|
||||
_instantiated_dragons[properties.id] = dragon
|
||||
return dragon
|
||||
|
||||
|
||||
func _pick_dragon(id: int, position: Vector2, hat: Texture2D, shirt: Texture2D, shoes: Texture2D, drag: bool = true):
|
||||
var dragon: Dragon = _instantiator.instantiate(position, hat, shirt, shoes, drag)
|
||||
dragon.id = id
|
||||
_dragon_entities[id] = dragon
|
||||
func _pick_dragon(properties: DragonProperties, drag: bool = true):
|
||||
var dragon: Dragon = _instantiator.instantiate(properties, drag)
|
||||
_dragon_entities[properties.id] = dragon
|
||||
dragon.place_back.connect(_dragon_place_back)
|
||||
add_child(dragon)
|
||||
_instantiated_dragons.erase(id)
|
||||
_instantiated_dragons.erase(properties.id)
|
||||
|
||||
for spot in _filled_spots:
|
||||
if _filled_spots[spot] == id:
|
||||
if _filled_spots[spot] == properties.id:
|
||||
_filled_spots.erase(spot)
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=18 format=3 uid="uid://ctytpqaed0yqx"]
|
||||
[gd_scene load_steps=16 format=3 uid="uid://ctytpqaed0yqx"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://3kyt3shje5r1" path="res://scenes/main.gd" id="1_sugp2"]
|
||||
[ext_resource type="PackedScene" uid="uid://c7nfcgjxqeg7l" path="res://scenes/window/dragon_popup.tscn" id="2_jyhfs"]
|
||||
|
@ -11,8 +11,6 @@
|
|||
[ext_resource type="Resource" uid="uid://ba5684xylts3f" path="res://assets/outfits/shoes.tres" id="6_ya4ey"]
|
||||
[ext_resource type="Script" uid="uid://oc6mw86npbii" path="res://scenes/list_button.gd" id="9_choun"]
|
||||
[ext_resource type="PackedScene" uid="uid://tubxrqxjic6r" path="res://scenes/dragon_list/dragon_list.tscn" id="10_ya4ey"]
|
||||
[ext_resource type="Script" uid="uid://w60u0tg1hlvu" path="res://scenes/dragon_adder.gd" id="11_eb6dy"]
|
||||
[ext_resource type="PackedScene" uid="uid://oqa2ry73vqjf" path="res://scenes/dragon_adder/dragon_adder.tscn" id="12_trceg"]
|
||||
[ext_resource type="Texture2D" uid="uid://bc2lykc3gwykh" path="res://assets/sprites/environment/castle/DP_castle_back.png" id="15_muem4"]
|
||||
[ext_resource type="Texture2D" uid="uid://o1e8lge2vuqu" path="res://assets/sprites/environment/castle/DP_castle_mid.png" id="16_dp3eg"]
|
||||
[ext_resource type="Texture2D" uid="uid://b1w6y1qvetsaw" path="res://assets/sprites/environment/castle/DP_castle_front.png" id="17_0ld40"]
|
||||
|
@ -72,20 +70,6 @@ text = "llista"
|
|||
script = ExtResource("9_choun")
|
||||
dragon_list = ExtResource("10_ya4ey")
|
||||
|
||||
[node name="Adder" type="Button" parent="CanvasLayer"]
|
||||
anchors_preset = 1
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
offset_left = -393.0
|
||||
offset_top = 14.0
|
||||
offset_right = -329.0
|
||||
offset_bottom = 45.0
|
||||
grow_horizontal = 0
|
||||
focus_mode = 0
|
||||
text = "afegeix"
|
||||
script = ExtResource("11_eb6dy")
|
||||
dragon_adder = ExtResource("12_trceg")
|
||||
|
||||
[node name="Castle" type="Node2D" parent="."]
|
||||
|
||||
[node name="DpCastleBack" type="Sprite2D" parent="Castle"]
|
||||
|
@ -120,4 +104,3 @@ script = ExtResource("17_muem4")
|
|||
[connection signal="button_up" from="CanvasLayer/Create" to="CanvasLayer/Create" method="_on_button_up"]
|
||||
[connection signal="pressed" from="CanvasLayer/Close" to="." method="_on_close_pressed"]
|
||||
[connection signal="pressed" from="CanvasLayer/List" to="CanvasLayer/List" method="_on_pressed"]
|
||||
[connection signal="pressed" from="CanvasLayer/Adder" to="CanvasLayer/Adder" method="_on_pressed"]
|
||||
|
|
|
@ -17,7 +17,7 @@ var _fall_speed: float
|
|||
|
||||
signal place_back(dragon: Dragon)
|
||||
|
||||
var id: int
|
||||
var properties: DragonProperties
|
||||
|
||||
|
||||
enum State {
|
||||
|
@ -64,8 +64,8 @@ func _process(delta: float) -> void:
|
|||
_move_to_target(delta)
|
||||
|
||||
|
||||
func dress(hat: Texture2D, shirt: Texture2D, shoes: Texture2D):
|
||||
dragon.dress(hat, shirt, shoes)
|
||||
func dress():
|
||||
dragon.dress(properties)
|
||||
|
||||
|
||||
func _think_path():
|
||||
|
|
|
@ -10,11 +10,8 @@ func _init(dragon: PackedScene, viewport: Viewport, window: Window) -> void:
|
|||
_dragon_template = dragon
|
||||
|
||||
|
||||
func instantiate(position: Vector2, hat: Texture2D, shirt: Texture2D, shoes: Texture2D, drag: bool) -> Node:
|
||||
if drag == false:
|
||||
return _instantiate_dragon(position, hat, shirt, shoes, drag)
|
||||
var relative_position: Vector2i = _calculate_relative_position(position)
|
||||
return _instantiate_dragon(relative_position, hat, shirt, shoes, drag)
|
||||
func instantiate(properties: DragonProperties, drag: bool) -> Node:
|
||||
return _instantiate_dragon(properties, drag)
|
||||
|
||||
|
||||
func _calculate_window_scale() -> Vector2:
|
||||
|
@ -29,19 +26,19 @@ func _calculate_relative_position(position: Vector2) -> Vector2i:
|
|||
return Vector2i(Vector2(position) * scale)
|
||||
|
||||
|
||||
func _instantiate_dragon(relative_position: Vector2i, hat: Texture2D, shirt: Texture2D, shoes: Texture2D, drag: bool) -> Node:
|
||||
func _instantiate_dragon(properties: DragonProperties, drag: bool) -> Node:
|
||||
var dragon: Dragon = _dragon_template.instantiate()
|
||||
dragon.properties = properties
|
||||
|
||||
var window_position: Vector2i = DisplayServer.window_get_position()
|
||||
var window_size: Vector2i = DisplayServer.window_get_size()
|
||||
|
||||
if drag == false:
|
||||
dragon.position = relative_position
|
||||
dragon.position = properties.position
|
||||
else:
|
||||
dragon.position = window_position + relative_position - dragon.size / 2
|
||||
dragon.dress(hat, shirt, shoes)
|
||||
dragon.position = window_position + _calculate_relative_position(properties.position) - dragon.size / 2
|
||||
dragon.dress()
|
||||
|
||||
var size: float = _calculate_window_scale().y
|
||||
dragon.main_window_rect = Rect2i(window_position, window_size)
|
||||
dragon.show()
|
||||
|
||||
|
|
|
@ -4,16 +4,6 @@ class_name DragonLibrary
|
|||
|
||||
var dragons: Array[DragonProperties] = []
|
||||
|
||||
var hat_outfits: DragonOutfit
|
||||
var shirt_outfits: DragonOutfit
|
||||
var shoes_outfits: DragonOutfit
|
||||
|
||||
|
||||
func _init(hat_outfits: DragonOutfit, shirt_outfits: DragonOutfit, shoes_outfits: DragonOutfit) -> void:
|
||||
self.hat_outfits = hat_outfits
|
||||
self.shirt_outfits = shirt_outfits
|
||||
self.shoes_outfits = shoes_outfits
|
||||
|
||||
|
||||
func add_dragon(properties: DragonProperties) -> int:
|
||||
if properties.id == 0:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue