Godot looting
Got a little further today.
Repeated setting up the Area2D pattern for handling the on_area_entered signal.
The next step in the project was to randomly generate loot.
This required a base Node2D with a child Timer node.
The timer node was needed to emit timeout
signals at regular intervals to trigger item spawns.
get_node("Timer").timeout.connect(_on_timer_timeout)
Then to handle the timeout:
-> void:
func _on_timer_timeout() = item_scenes.pick_random()
var random_item_scene: PackedScene := random_item_scene.instantiate()
var item_instance add_child(item_instance)
It looks a little goofy since I still haven’t removed the hardcoded behavior of queue_free
on area entered for items.
Random aside, faillock
is handy for when you mess up your sudo password a few times in a row and got locked out.
faillock --user {user-who-inted-away-password-attemps} # list your failed attemps
faillock --user {user-who-trolled} --reset # resets your lock so you can try again
Thanks for reading!