system
1
|
|
|
|
Attention |
Topic was automatically imported from the old Question2Answer platform. |
|
Asked By |
ZeralldGames |
Привет еще раз,господа
Я хочу каким то образом заливать,например,текстовый документ (doc.txt) на сайт
Потом мне как то надо вывести данные из этого текстового документа в godot (в игру мою)
Вообще без понятия как сделать
system
2
|
|
|
|
Reply From: |
sergkis |
Answer in the language of the question
Добавьте на сцену узел HTTPRequest
и прикрепите к нему данный скрипт:
extends HTTPRequest
func _ready():
set_download_file("res://image.png")
request("http://docs.godotengine.org/en/stable/_static/docs_logo.png")
func _on_HTTPRequest_request_completed( result, response_code, headers, body ):
if(result == HTTPRequest.RESULT_SUCCESS):
print("!!!")
else:
print(":(")
Не забудьте подключить сигнал _on_HTTPRequest_request_completed
от узла к скрипту.
Translation for English-speaking users
Question:
Long story short. How to download file from web?
Answer:
Add the HttpRequest
node to the scene and attach this script:
extends HTTPRequest
func _ready():
set_download_file("res://image.png")
request("http://docs.godotengine.org/en/stable/_static/docs_logo.png")
func _on_HTTPRequest_request_completed( result, response_code, headers, body ):
if(result == HTTPRequest.RESULT_SUCCESS):
print("!!!")
else:
print(":(")
Don’t forget to connect the _on_HTTPRequest_request_completed
signal from the node to the script.