gdscript-playground
gdscript-playground copied to clipboard
Add some presets of scripts as examples
@triptych Hey! I've refactored the entire UI and added a base for script examples!
What do you think?
Btw, I already deployed it for tests: https://gd.tumeo.space/
What would be some desired script presets? @williamd1k0
Some ideas off the top of my head:
- A simple FSM using a State class and a function to switch states
- Some kind of simple demo showcasing Thread, Mutex, and Semaphore
- A simple physics scene made with code. Maybe a KinematicBody2D moves in random directions, collides with obstacles, and prints its position after each move_and_slide()
- An example of how to use signals and maybe yield()
I think these could be demonstrated just using print(), although it might be difficult because I don't think you can create packed scenes from code, which means no instancing and no more than 1 script.
More general programming problems:
- Fizz Buzz
- Maybe the first few problems on Project Euler
Some ideas for examples
- arrays: play with arrays functions, add, delete, find, clear, loops
- dictionaries: same as arrays but with more complex functions
- htttprequests: send and get data online (specacilly for those interested in online capabilities)
- vector2: calculations lenght,s angles...
- vector3: IDEM
@williamd1k0 Looks great! Glad to see it working! I could see the demos as a way to test out each api almost as a type of unit test style thing. Seeing the syntax in action is really a great way to learn more about GDScript.
Sorry for the late reply, I was super busy at my main job. 😣
@regakakobigman Since the current implementation does not support non-blocking code (yet), it's a bit hard to add complex and/or async examples such as yields.
@nitodico @triptych I just added simple examples for arrays and dictionaries. When I get more free time, I will try to add more examples.
Thank you for being interested in this project!
First of all thanks for this project, it should get more attention! Secondly, more or less a note to self: the examples are in https://github.com/williamd1k0/gdscript-playground/blob/master/gdscript/static/js/snippets.js
I would consider it an enhancement if there was a directory with *.gd scripts, which would make it easier to add examples. Again, thank you!