Description
Manages the visual, the audio and the boolean of a selection with the cursor.
it works with a behaviour and a module that you put in the event sheet. (they go hand in hand)
---CONTEXT--- and the problem it solves
this extension exist because the selection visual, sound, and variable (which are interconnected when dealing with cursor selection) are tricky for beginners to do. even though its a seemingly simple task. This is because when the cursor stops hovering on the first item, it might end up on another item without untrigerring the trigger once (due to the fact that selectables are next to each other). This issue is the main reason as to why the extension exist. Only one square should be selected at a time, hence the name: Unique Selection Visual
However... its sad to make an extension for just the visual (item get bigger when hovered). So I manage both the sound (selected and hovered) and the variable selected (stored in a behaviour property)
selection can be unique or capped
(note that this is my first published extension, be nice)
(note that i do not know JS so all the code is using events from GD)
(this extension uses another extension by silverstreak and krunkster named: play audio by file name. Because of this I want to credit them. do i have to do it manually or is the dependency automatically detected?)
proudly NO AI
How to use the extension
1: assign the behaviour "Unique sprite selection" to all your selectable sprites.
2: associate a sound for the hovering sound and/or the selection sound in the behaviour property. these can change dynamically and be different from instance to instance.
3: put the action "UniqueSelectionModule" in your event sheet. with the sprites having the behaviour. You can put a group, but every element of the group must be sprites and have the behaviour
4: if you want the selection to be unique (i.e. only one item will be selected at a time), put a 1 as the maxSelected. if you want many items to be selected at a time, you can increase that number to whatever you want (putting a float will not break the extension, it is just as if the number was truncated).
anytime you want to check the state of the selection boolean, use "sprite is selected" condition (and reverse it for checking unselected)
Checklist
AI usage
Example file
small tests.zip
Extension file
UniqueSelectionVisual.zip
Description
Manages the visual, the audio and the boolean of a selection with the cursor.
it works with a behaviour and a module that you put in the event sheet. (they go hand in hand)
---CONTEXT--- and the problem it solves
this extension exist because the selection visual, sound, and variable (which are interconnected when dealing with cursor selection) are tricky for beginners to do. even though its a seemingly simple task. This is because when the cursor stops hovering on the first item, it might end up on another item without untrigerring the trigger once (due to the fact that selectables are next to each other). This issue is the main reason as to why the extension exist. Only one square should be selected at a time, hence the name: Unique Selection Visual
However... its sad to make an extension for just the visual (item get bigger when hovered). So I manage both the sound (selected and hovered) and the variable selected (stored in a behaviour property)
selection can be unique or capped
(note that this is my first published extension, be nice)
(note that i do not know JS so all the code is using events from GD)
(this extension uses another extension by silverstreak and krunkster named: play audio by file name. Because of this I want to credit them. do i have to do it manually or is the dependency automatically detected?)
proudly NO AI
How to use the extension
1: assign the behaviour "Unique sprite selection" to all your selectable sprites.
2: associate a sound for the hovering sound and/or the selection sound in the behaviour property. these can change dynamically and be different from instance to instance.
3: put the action "UniqueSelectionModule" in your event sheet. with the sprites having the behaviour. You can put a group, but every element of the group must be sprites and have the behaviour
4: if you want the selection to be unique (i.e. only one item will be selected at a time), put a 1 as the maxSelected. if you want many items to be selected at a time, you can increase that number to whatever you want (putting a float will not break the extension, it is just as if the number was truncated).
anytime you want to check the state of the selection boolean, use "sprite is selected" condition (and reverse it for checking unselected)
Checklist
AI usage
Example file
small tests.zip
Extension file
UniqueSelectionVisual.zip