GDevelopApp / GDevelop-extensions

Repository of behaviors, actions, conditions and expressions to be used in GDevelop for creating games
https://gdevelop.io
MIT License
131 stars 52 forks source link

Choose Random Number or String given a string of values #209

Closed UlisesFreitas closed 3 years ago

UlisesFreitas commented 3 years ago

Choose

How to use it

Choose from list of given string of values and return one of the randomly

How to use it

Create a new variable of the type you want Number/String then go to Functions and select Choose::RandomString or Choose::RandomNumber and set the values you want to randomize separated by commas. Done.

Extra

Check a mini tutorial: https://youtu.be/h0uLECuAwko Here the project: https://drive.google.com/file/d/1ydRdbEsFX-MVKaWv6lpq7GAeWEkBQiCr

Checklist

Extension file

Choose.zip

Bouh commented 3 years ago

For tracking this extension on forum: https://forum.gdevelop-app.com/t/extension-choose-random-number-string-given-a-list/34703/4

4ian commented 3 years ago

Nice! A good idea to have an extension like this.

I've simplified the whole implementation from this: image

to this: image

There was actually no need to use GDevelop variables here, JS variables are fine :) I've also updated various descriptions.

Thanks for submitting this, this will be very useful I think to have this capability.

arthuro555 commented 3 years ago

Actually, I was reviewing this too and had already rewritten it with GDevelop events 👀

4ian commented 3 years ago

Ah sorry for the useless work then.. I should have said I was on it!

UlisesFreitas commented 3 years ago

Thank you all for taking into account.

arthuro555 commented 3 years ago

Well, in case anyone is interested here is my events based version (number version not working for an unknown reason): game.zip

UlisesFreitas commented 3 years ago

Hi here the extension with my username added as the author of the extension Choose.zip

Bouh commented 3 years ago

Thank you @UlisesFreitas, done in https://github.com/GDevelopApp/GDevelop-extensions/commit/a4820b836b341455b4d04ab353ad6334d4d24976