feat: properly scale instantiated dragons
This commit is contained in:
parent
a169e953c3
commit
09586aaa5e
5 changed files with 12 additions and 5 deletions
|
@ -2,6 +2,7 @@ extends Window
|
|||
class_name Dragon
|
||||
|
||||
@export var dragon_speed: float = 20.0
|
||||
@export var dragon: Node2D
|
||||
|
||||
@onready var _actual_position: Vector2 = position
|
||||
var main_window_rect: Rect2i
|
||||
|
@ -63,3 +64,8 @@ func _pick_random_screen_position() -> void:
|
|||
)
|
||||
|
||||
_target_pos = random_pos
|
||||
|
||||
|
||||
func set_scale(scale: float) -> void:
|
||||
size = Vector2i(size.x * scale, size.y * scale)
|
||||
dragon.scale = Vector2(scale, scale)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
[ext_resource type="Script" uid="uid://ch7d3wo8ucskb" path="res://scenes/window/draggable.gd" id="2_2r6si"]
|
||||
[ext_resource type="PackedScene" uid="uid://baa8gpicw2yg0" path="res://scenes/dragons/dragon_sprite.tscn" id="3_ctdir"]
|
||||
|
||||
[node name="DragonPopup" type="Window"]
|
||||
[node name="DragonPopup" type="Window" node_paths=PackedStringArray("dragon")]
|
||||
disable_3d = true
|
||||
transparent_bg = true
|
||||
size = Vector2i(128, 128)
|
||||
|
@ -13,6 +13,7 @@ borderless = true
|
|||
transparent = true
|
||||
script = ExtResource("1_ctdir")
|
||||
dragon_speed = 100.0
|
||||
dragon = NodePath("Dragon")
|
||||
|
||||
[node name="DragDropDetector" type="Control" parent="."]
|
||||
layout_mode = 3
|
||||
|
@ -22,4 +23,3 @@ offset_bottom = 40.0
|
|||
script = ExtResource("2_2r6si")
|
||||
|
||||
[node name="Dragon" parent="." instance=ExtResource("3_ctdir")]
|
||||
position = Vector2(64, 64)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue