Platform-Style Video Games with Construct

Activating Visual Effects with Events

Your browser needs to be JavaScript capable to view this video

Try reloading this page, or reviewing your browser settings

This video shows how to use events to activate visual special effects when the player character interacts with different elements of the level.


  • Construct 2
  • Events

About this video

Lee Stemkoski
First online
15 February 2019
Online ISBN
Copyright information
© Lee Stemkoski 2019

Video Transcript

Lee Stemkoski: Next, it’s time to go to the Event sheet. Every time an item is collected, we’d like to spawn a sparkle and set the animation, so it’s colored correctly. So let’s go up to some of our Koala on collision with, first, when the Koala collides with the Coin. Let’s click on Add action for that particular event. Let’s have the coins spawned another object. This is a Coin action. Under Miscellaneous, we’ll spawn another object. That object will be a Sparkle. We’ll spawn that on the Main layer. We’ll add an action. So the sparkle is colored yellow. Let’s add an action. This is a Sparkle action. Will affect the sparkle that was just created. Under Animations, let’s choose Set animation. In quotation marks, we’ll type Yellow.

Do the same thing with the Heart. The heart on collision with heart event, let’s choose Add action. Heart will spawn another object. That object, we’ll click to choose a Sparkle. We’ll spawn that on the Main layer. We’ll add an action for the sparkle to set the animation to Red. The clock has a little bit of purple around the rim, so we’ll add a purple sparkle in this case. So the event where the Koala collides with the Clock, let’s add an action. It’ll be a Clock action to Spawn another object. That object is a Sparkle. Spawn that on the Main layer.

And one final action, the Sparkle. Let’s set the animation to the one named Violet. Our last collectible item. I have to scroll down a bit. That’s when you collide with a BlueKey. So On collision with KeyBlue, let’s add an action. In this case, the blue key will spawn another object. That object is again, a Sparkle. Spawn that on the Main layer. And we want that Sparkle to be colored correctly, so we’ll add a fourth action. A Sparkle action, Set animation to Blue.

Finally, we’ll make some smoke up here whenever the Koala overlaps an enemy and the enemy is destroyed. So that’s this event here, or the enemy gets destroyed. Let’s add an action, and this action, the enemy will spawn another object. And in this case, not a Sparkle, but an Explosion. On the Main layer. Finally, we need to change the animation being used for the explosion. So this action will be an Explosion action that we’re adding. We’ll Set animation, and in this case, since we were very clever about naming the animation of the explosion with the same names we used for the animations of the enemy, we will not type something in quotation marks this time. Instead, we’ll type Enemy.AnimationName. In this case, it will load the animation that has the same animation name of the enemy with which we’ve collided.

Once you’ve typed that in, we’ll click on Done. Now we’re ready to test. Let’s save and we’ll run the game. We’re going to try to interact with each object, make sure the correct effect appears and the correct color. So first, I’ll go ahead and jump on that slime. We should see a pink explosion. Clicking these coins should give us yellow sparkles. Collecting that heart and that clock should give us a red and a blue sparkle, or red and purple. And now jumping on that fly should give us a gray smoke cloud, a gray explosion and collecting the key should give us a blue sparkle. Excellent. All the visual effects work, gives you a player some good feedback for the game, and so the visual effects are complete.