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

Checkbox (New extension) #101

Closed tristanbob closed 3 years ago

tristanbob commented 3 years ago

Describe the extension

Checkbox that can be toggled by a left-click or touch. When the checkbox is checked, the condition Checked is TRUE. A halo appears when the mouse hovers near the checkbox. When Disabled, the checkbox cannot be toggled by users (but can still be changed from an event action). Checkbox cannot be toggled when it is hidden (or if the object's layer is hidden).

Checklist

Extension file

CheckboxExtension-0.0.2.json.zip

Example game

https://games.gdevelop-app.com/game-0ccb37d7-650e-4eb9-beec-e1c57805f492/index.html

Video

https://user-images.githubusercontent.com/8879811/105803588-0b3ad600-5f5b-11eb-9bb3-bc7c10902f50.mp4

4ian commented 3 years ago

Awesome! I'll review that :)

4ian commented 3 years ago

Works great! I've tried with a few checkboxes on multiple layers and can't find any problem.

Small nitpicking, avoid "Returns TRUE if ..." in the description of conditions. Instead, write "Check if ...". It's a bit more generic, and more friendly for someone not well used to programming language names.

Also, I see an action to disable the checkbox, but not to enable it? Tip: Keep a single action, but use a parameter "Disable?" which is Yes/No.

Finally, maybe you could do the same for SetChecked: remove SetUnChecked and add a parameter to SetChecked that is a Yes/No boolean. You can name it in the editor "Check (or uncheck) the checkbox", so that unchecking is still easy to find for the user :) That will 1) reduce the number of actions and 2) will be ready for later when we can have boolean expressions.

tristanbob commented 3 years ago

I don't mind the nitpicking; I'm actually very grateful for it! I am trying my best to follow your style for wording, using the extension best practices . If you can add more wording examples on that page, it will help a lot. (FYI - I just reviewed your Health extension, which has good action/condition/expression examples)

Version 0.0.3

Changes include:

File

CheckboxExtension-0.0.3.json.zip

4ian commented 3 years ago

Thanks for the update! I've spent a bit of time adding examples in the page, and I've also added new notes about dealing with booleans :)

Let me know if that make sense. We can submit this extension once these last points are ironed out!

4ian commented 3 years ago

Your extension made me realize that you've created a bunch of expression (which is great!) but it would be even cooler if GDevelop would generate, automatically, the associated conditions. I've made a card about this in the roadmap: https://trello.com/c/zwo0T1E7/479-add-in-events-function-a-condition-expression-type-that-would-allow-to-generate-both-an-expression-and-a-condition-to-check-it

I suggest you continue making expressions (just make sure to choose the proper type: expression or string expressions ;)) (apart for booleans, where a condition should be used) and I can introduce this capability later.

tristanbob commented 3 years ago

Version 0.0.4

Changes include:

File

CheckboxExtension-0.0.4.json.zip

4ian commented 3 years ago

Looks good, thanks! Added to the registry. Great work again 👍👍