Loading scenes/dragon_sharing.gd +1 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ func _ready() -> void: func _on_request_completed(_result: int, response_code: int, _headers: PackedStringArray, body: PackedByteArray): if response_code != 200: print("HTTP request returned error: ", response_code) on_dragon_received.emit(null) return if body.size() != 0: var json = JSON.parse_string(body.get_string_from_utf8()) Loading scenes/main.gd +3 −1 Original line number Diff line number Diff line Loading @@ -56,6 +56,8 @@ func _instantiate_random_dragon(): for i in range(5): dragon_sharing.receive("potato") var dragon: DragonProperties = await dragon_sharing.on_dragon_received if dragon == null: return for d in _library.dragons: # TODO: Search for dragon and if is in library or in instantiated dragons continue next iteration pass Loading Loading @@ -146,7 +148,7 @@ func _quit_dragon(id: int): func _dragon_place_back(dragon: Dragon): _dragon_entities.erase(dragon.id) _dragon_entities.erase(dragon.properties.id) func _on_close_pressed() -> void: Loading Loading
scenes/dragon_sharing.gd +1 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ func _ready() -> void: func _on_request_completed(_result: int, response_code: int, _headers: PackedStringArray, body: PackedByteArray): if response_code != 200: print("HTTP request returned error: ", response_code) on_dragon_received.emit(null) return if body.size() != 0: var json = JSON.parse_string(body.get_string_from_utf8()) Loading
scenes/main.gd +3 −1 Original line number Diff line number Diff line Loading @@ -56,6 +56,8 @@ func _instantiate_random_dragon(): for i in range(5): dragon_sharing.receive("potato") var dragon: DragonProperties = await dragon_sharing.on_dragon_received if dragon == null: return for d in _library.dragons: # TODO: Search for dragon and if is in library or in instantiated dragons continue next iteration pass Loading Loading @@ -146,7 +148,7 @@ func _quit_dragon(id: int): func _dragon_place_back(dragon: Dragon): _dragon_entities.erase(dragon.id) _dragon_entities.erase(dragon.properties.id) func _on_close_pressed() -> void: Loading