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
|
@ -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)
|
||||
|
||||
var size: float = _calculate_window_scale().y
|
||||
dragon.position = window_position + _calculate_relative_position(properties.position) - dragon.size / 2
|
||||
dragon.dress()
|
||||
|
||||
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