feat: choose outfit from library when creating a dragon
This commit is contained in:
parent
fd8609c0ab
commit
f07b28d2dc
22 changed files with 370 additions and 17 deletions
|
@ -1,4 +1,5 @@
|
|||
extends Node
|
||||
class_name GameManager
|
||||
|
||||
|
||||
@export var dragon_template: PackedScene
|
||||
|
@ -29,20 +30,22 @@ func move_window_to_bottom_right():
|
|||
DisplayServer.window_set_position(new_position)
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_pressed() and event.is_action("ui_accept"):
|
||||
_instantiate_dragon_ingame(dragon_spots[0].position)
|
||||
func add_dragon(hat: Texture2D, shirt: Texture2D, shoes: Texture2D):
|
||||
# TODO: Check for free positon
|
||||
_instantiate_dragon_ingame(dragon_spots[0].position, hat, shirt, shoes)
|
||||
# TODO: Add to dragon library
|
||||
|
||||
|
||||
func _instantiate_dragon_ingame(position: Vector2):
|
||||
func _instantiate_dragon_ingame(position: Vector2, hat: Texture2D, shirt: Texture2D, shoes: Texture2D):
|
||||
var dragon: DragonEntity = dragon_ingame.instantiate()
|
||||
dragon.dress(hat, shirt, shoes)
|
||||
add_child(dragon)
|
||||
dragon.position = position
|
||||
dragon.on_pick.connect(_pick_dragon)
|
||||
|
||||
|
||||
func _pick_dragon(position: Vector2):
|
||||
var dragon: Dragon = _instantiator.instantiate(position)
|
||||
func _pick_dragon(position: Vector2, hat: Texture2D, shirt: Texture2D, shoes: Texture2D):
|
||||
var dragon: Dragon = _instantiator.instantiate(position, hat, shirt, shoes)
|
||||
dragon.place_back.connect(_dragon_place_back)
|
||||
add_child(dragon)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue