Interacting with the player, second version: drug and drop in the basket the right items
In this minigame the player must drag the fruits whose name starts with A and drop them in the basket. It is implemented with three layers within one Layout called Alphabet
The Apple Sprite, has the Behaviors: DragDrop, that enables this sprite to be picked up and dropped, and BoundToLayout that make sure that the Apple is not thrown outside the page.
The Apricot Sprite, has the same Behaviors as the Apple.
The Pineapple Sprite, in addition has the Behaviors EaseTween. The latter customer-contributed behavior makes so that when the Pineapple is rejected, then moves back to the original position.
The Box Sprite has no behavior, as the InvisBox too, the latter however has additionally the property initial visibility: Invisible.
All sprites have the property collisions enabled.
The corresponding Alphabet Event sheet follows
This minigame grows in complexity. Here we have a global counter Objectsinbox that is incremented each time a fruit starting with A is dropped in the basket. When the maximum value is reached (e.g. all the A-fruits are in the box) then (event 5) the cheer is played and goes back to the Title
This minigame introduce us the Drag and Drop interaction with the player as follows:
when the Apple or the Apricot collide against the invisBox then the global counter Objectsinbox is incremented, the fruit that is there cannot be dragged anymore and therefore its Behavior Drag and Drop is deactivated, finally a nice sound is played.
A final detail is the use of a non standard Behavior:EaseTween 1.6 Behavior
When the Pineapple collides against the Box then a boing is played, the object is "dropped" and then the EasyTween effect is started, using the properties specified in the Pineapple property table:
Conclusions
From this Layout we have learned:
- how to use drag and drop
- how to use a global counter and then an event on that to trigger major activity
- how to use custom plugin behavior to generate bounce-back effect