Daily Godot Tip #4: If you have an array of items that you need to pick a random thing from, Godot has a built in pick_random method

https://programming.dev/pictrs/image/a2805429-b406-4b67-bba2-e28df59fe9af.webm

73 points · 2 comments · view on lemmy.world

2 Comments

pe1uca@lemmy.pe1uca.dev · 11 pts · 2y

Good tip, just also good to remember there's no way to control the seed of the generator, for example for a seeded world.
For that use case you still need to manually run the generator you created with your seed to select an item.

subignition@fedia.io · 4 pts · 2y

I think convenience methods like this are great, but making small little functions like this yourself can also be good exercises for beginner programmers.

WerDei@lemmy.blahaj.zone · 1 pts · 2y
[ removed ]