This commit is contained in:
Torsten 2025-11-04 08:02:10 +01:00
parent c1c5541ccd
commit 08ed389c8a
16 changed files with 1216 additions and 34421 deletions

View file

@ -0,0 +1,35 @@
```python
extends Control
@onready var http_request: HTTPRequest = $btn_login/HTTPRequest
@onready var te_result: TextEdit = $te_result
var url = "http://godotweb.local/api/login"
func _on_btn_login_button_up() -> void:
var headers = ["Content-Type: application/json"]
var data_to_send = {
"email" : $le_user.text,
"password" : $le_password.text
}
var json:String = JSON.stringify(data_to_send)
http_request.request(url, headers, HTTPClient.Method.METHOD_POST, json)
func _on_http_request_request_completed(result: int, response_code: int, headers: PackedStringArray, body: PackedByteArray) -> void:
if response_code != 201:
print("Login error.")
return
var data = JSON.parse_string(body.get_string_from_utf8())
print(data)
if data.status == false:
te_result.text = "Login refused"
else:
var token:String = data.data.token
te_result.text = "token: " + token
```
![[Pasted image 20241222121529.png]]

View file

@ -0,0 +1,14 @@
```python
extends TileMapLayer
signal hex_clicked(cell_pos:Vector2, atlas_coords:Vector2)
func _ready():
print("TileMapLayer is alive")
func _input(event: InputEvent):
#print("Unhandled input")
if event is InputEventMouseButton:
if event.pressed==false: return
```

View file

@ -0,0 +1,20 @@
Runtime tools
* Addon: godot-console
* Addon: godot-debug-menu-demo => display FPS
* os.has_feature("editor"), os.has_feature("debug"), os.has_feature("debug") to conditionally toggle
https://youtu.be/7gnozJ7KPK4?si=IvqeIRyLJSed2mhV
Tool Scripts: Make script available from inside the editor
@tool at top of script
![[Pasted image 20250322152916.png]]
---
![[Pasted image 20250322153032.png]]
![[Pasted image 20250322153057.png]]
=> Engine.is_editor_hint() to check if script is running in editor, disable functionality when inside editor

View file

@ -0,0 +1 @@
https://www.youtube.com/watch?v=KOI0y1OC_tM&list=WL&index=1