Tips and Kliks #02: Anatomy of an Event

Danni's picture

We will start off by jumping straight into the Event Editor, as that is the heart of Klik's true power, the place where you will spend most of your time designing your game's behaviors. For these next few articles, we will cover the basics you need to know to get the most out of the Event Editor.

In order to become a Klik Ace, you need ACE: Actions, Conditions, and Events. In the Event Editor, these are the building blocks that you use to describe your object behaviors. Understanding the role of each is key to understanding the Event Editor.

Actions are simply things that you can do in your game. Some examples of actions:

- Stop
- Destroy
- Create a new object
- Change animation sequence
- Add to the player's score
- Jump to the next level/frame

Conditions are bits of criteria. Some examples of conditions:

- Start of frame/start of level
- Player pressed Fire 1
- Two objects are overlapping each other
- An object is below a certain Y coordinate
- An animation has finished

Events are units that contain a set of Actions and Conditions. If the conditions for a given event are satisfied, the actions are performed.

Pictured: An event that causes the player to fire a bullet when pressing button 1, as long as there are less than three bullets in play.

Note that conditions actually have two functions. First, a condition may either be true or false. For example, if the player is holding button 1, then the condition "Repeat while Player pressed Fire 1" would be true. If the player's score is only 1000, then the condition "Player's score is greater than 2000" would be false.

An event's actions are only run if all of its conditions are true!

Second, a condition may limit which object(s) an action is applied to. Let's say you have an event with one condition: "Player pressed Fire 1". If we give this event a "Destroy Monster" action, it will destroy every single Monster in the level when you press button 1.

What if we replace that condition with "Collision between Bullet and Monster"? We will keep the "Destroy Monster" action. This time, when the condition is true, only the Monsters that have collided with any Bullets will be destroyed.

Typically, conditions serve to eliminate possible objects. That is, you use conditions to only apply actions to certain objects, and each additional limiting condition further reduces which objects targeted by the actions. There are exceptions, of course. Take the "Pick an object at random" condition. Its first use will eliminate all objects of a given type except for one that has been chosen at random. What happens if you add multiple copies of this condition? Now the actions apply to more objects! If you have "Pick an object at random" three times in an event, three objects will be picked (assuming there are three - if there are less than three, only that many will be picked).

Feel free to play around with different conditions and actions! Next, we will be covering the use of a few specific basic but important conditions.

pensive-mosquitoes