The game file to import and load for this session is 5961_05_07.stencyl
.
Collides with Collectibles
event; click on the Dashboard tab, select Actor Behaviors, and double-click on the Manage Player Collisions icon in the main panel.0
into the w: textbox and 0
into the h: textbox.0.5
in the textbox that appears after the word over.0.5
seconds.We have modified the Collides with Collectibles
event in the Manage Player Collisions
behavior so that the collectible items shrink away to nothing when the monkey collides with it.
Originally, when a collision occurred between the monkey and a collectible, the collectible would fade away, but we dragged the original fade out…
block into the trashcan to remove it from the event. Holding down the Shift key when dragging a block ensures that only a single block is dragged.
We then located the grow…
instruction block in the palette, dragged it into the event, and changed the timing of the grow effect to 0.5
seconds. The w: and h: textboxes in the grow...
instruction specify the final width and height of the actor when the effect has completed. In our case, we set both the w: and h: settings to 0, because we want the actor to shrink so that it is no longer visible. If we needed an actor to grow, we could specify the final w: and h: sizes to be greater than 100 percent; for example, setting the size to 200 percent would make the actor grow to twice its original size.
The final step was to modify the timing in the kill… of group
block, so that the actor will not be removed from the scene until the grow effect has completed.
We have now used both a fade…
block (which we have now removed) and a grow…
block in our game.
Experiment with the grow effect option (currently set to None
) and the timings of the grow...
block in the Collides with Collectibles
event, remembering also to change the timing of the do after…
block.
Also, take this opportunity to review the available Tweening blocks in the palette, and consider how they may be used to make interesting special effects in our game. We've only touched on how to use the effects that are available to us, so go ahead and try various combinations of effects; some will look great, and some may be a little over-the-top, but have some fun while learning!
18.117.238.40