Loading scenes/dragon_editor/dragon_editor.gd +0 −4 Original line number Diff line number Diff line Loading @@ -40,9 +40,5 @@ func _on_change_shoes_pressed() -> void: func _on_create_pressed() -> void: if dragon_name.text.is_empty(): return var result: String = CodeGenerator.new(hat_outfits, shirt_outfits, shoes_outfits).encrypt(hat.texture, shirt.texture, shoes.texture, dragon_name.text) print(result) var decrypted: Dictionary = CodeGenerator.new(hat_outfits, shirt_outfits, shoes_outfits).descrypt(result) print(decrypted) on_create_dragon.emit(hat.texture, shirt.texture, shoes.texture, dragon_name.text) queue_free() scenes/main.gd +15 −2 Original line number Diff line number Diff line Loading @@ -6,6 +6,8 @@ class_name GameManager @export var dragon_ingame: PackedScene @export var dragon_spots: Array[Node2D] var _filled_spots: Dictionary[Node2D, int] @export var hat_outfits: DragonOutfit @export var shirt_outfits: DragonOutfit @export var shoes_outfits: DragonOutfit Loading @@ -27,6 +29,10 @@ func _ready(): _load_game() func _instantiate_random_dragon(): pass func move_window_to_bottom_right(): var display_index: int = DisplayServer.window_get_current_screen() Loading @@ -42,9 +48,12 @@ func move_window_to_bottom_right(): func add_dragon(hat: Texture2D, shirt: Texture2D, shoes: Texture2D, dragon_name: String): # TODO: Check for free positon var id: int = _library.add_dragon(dragon_name, hat, shirt, shoes) _instantiate_dragon_ingame(dragon_spots[0].position, hat, shirt, shoes, dragon_name, id) for spot in dragon_spots: if not _filled_spots.has(spot): _instantiate_dragon_ingame(spot.position, hat, shirt, shoes, dragon_name, id) _filled_spots[spot] = id break func _load_game(): Loading Loading @@ -77,6 +86,10 @@ func _pick_dragon(id: int, position: Vector2, hat: Texture2D, shirt: Texture2D, dragon.place_back.connect(_dragon_place_back) add_child(dragon) for spot in _filled_spots: if _filled_spots[spot] == id: _filled_spots.erase(spot) func _dragon_place_back(dragon: Dragon): _dragon_entities.erase(dragon.id) Loading Loading
scenes/dragon_editor/dragon_editor.gd +0 −4 Original line number Diff line number Diff line Loading @@ -40,9 +40,5 @@ func _on_change_shoes_pressed() -> void: func _on_create_pressed() -> void: if dragon_name.text.is_empty(): return var result: String = CodeGenerator.new(hat_outfits, shirt_outfits, shoes_outfits).encrypt(hat.texture, shirt.texture, shoes.texture, dragon_name.text) print(result) var decrypted: Dictionary = CodeGenerator.new(hat_outfits, shirt_outfits, shoes_outfits).descrypt(result) print(decrypted) on_create_dragon.emit(hat.texture, shirt.texture, shoes.texture, dragon_name.text) queue_free()
scenes/main.gd +15 −2 Original line number Diff line number Diff line Loading @@ -6,6 +6,8 @@ class_name GameManager @export var dragon_ingame: PackedScene @export var dragon_spots: Array[Node2D] var _filled_spots: Dictionary[Node2D, int] @export var hat_outfits: DragonOutfit @export var shirt_outfits: DragonOutfit @export var shoes_outfits: DragonOutfit Loading @@ -27,6 +29,10 @@ func _ready(): _load_game() func _instantiate_random_dragon(): pass func move_window_to_bottom_right(): var display_index: int = DisplayServer.window_get_current_screen() Loading @@ -42,9 +48,12 @@ func move_window_to_bottom_right(): func add_dragon(hat: Texture2D, shirt: Texture2D, shoes: Texture2D, dragon_name: String): # TODO: Check for free positon var id: int = _library.add_dragon(dragon_name, hat, shirt, shoes) _instantiate_dragon_ingame(dragon_spots[0].position, hat, shirt, shoes, dragon_name, id) for spot in dragon_spots: if not _filled_spots.has(spot): _instantiate_dragon_ingame(spot.position, hat, shirt, shoes, dragon_name, id) _filled_spots[spot] = id break func _load_game(): Loading Loading @@ -77,6 +86,10 @@ func _pick_dragon(id: int, position: Vector2, hat: Texture2D, shirt: Texture2D, dragon.place_back.connect(_dragon_place_back) add_child(dragon) for spot in _filled_spots: if _filled_spots[spot] == id: _filled_spots.erase(spot) func _dragon_place_back(dragon: Dragon): _dragon_entities.erase(dragon.id) Loading