This commit is contained in:
Torsten 2024-12-22 14:02:54 +01:00
parent 1e22d28754
commit 6b926d3afe
126 changed files with 128562 additions and 104297 deletions

View file

@ -0,0 +1 @@
https://youtu.be/PDISK_JPPQE?si=3bIk5oyDBX9YDw6q

View file

@ -0,0 +1,3 @@
https://youtu.be/qwOM3v8T33Q?si=-0Lg0x6hNJJT9gNO
Continue around 10:00

View file

@ -0,0 +1 @@
https://youtu.be/R4xN4DTNDU4?si=EzYM1MMawKnQVq6B

View file

@ -0,0 +1,10 @@
pixel positions on the screen use Vector2 coordinates
cell to world using Vector2
```
var cell_size:Vector2 = Vector2(50.0, 50.0)
# or: var cell_size := Vector2(50.0, 50.0)
func grid_to_world(cell):
return cell + cell_size + cell_size / 2
```

View file

@ -0,0 +1 @@
https://youtu.be/43BZsLZheA4?si=c4FDGWrRWdAPjeMC

View file

@ -0,0 +1,6 @@
```python
func _ready() -> void:
var gem_scene := preload("gem.tscn")
var gem_instance := gem_scene.instantiate()
add_child(gem_instance)
```

View file

@ -0,0 +1,3 @@
```python
random_item_scene: PackedScene = item_scenes.pick_random()
```

View file

@ -0,0 +1,29 @@
```python
extends Node2D
var item_scenes := [
preload("gem.tscn"),
preload("health_pack.tscn")
]
func _ready():
get_node("Timer").timeout.connect(_on_timer_timeout)
func _process(delta):
pass
func _on_timer_timeout() -> void:
var random_item_scene: PackedScene = item_scenes.pick_random()
var item_instance = random_item_scene.instantiate()
add_child(item_instance)
var viewport_size = get_viewport_rect().size
var random_position := Vector2(0,0)
random_position.x = randf_range(0, viewport_size.x)
random_position.y = randf_range(0, viewport_size.y)
item_instance.position = random_position
```

View file

@ -0,0 +1,5 @@
Connecting the timeout signal of timer to a local function
```python
get_node("Timer").timeout.connect(_on_timer_timeout)
```

View file

@ -0,0 +1 @@
https://youtu.be/fzJJXuLzobs?si=L9LE1w6l0K_3BRGT