A core pillar and often relied upon aspect of game design is progression tracking through scoring. Here we’ll go over the two basic components of scoring: tracking and reporting.
To keep track of a player’s progression, you’ll first need to consider your game’s genre and objective. What types of actions or feats do you want to encourage by having them recognized and showcased? In the below example, we’ll look at a straight forward platformer with a focus on item collection.
Let’s assume that the fundamentals of the project are already in place: The main actor, platforms, treasure, and logic that considers user input and dictates movement. (These will be covered in more detail in subsequent tutorials)
However, while the treasure has already been configured to disappear upon colliding with the primary actor (henceforth referred to as “the Hero”), as of yet it has no behaviors in place to track how much has been picked up by the Hero.
Adding a Score…
To add in this feature, let’s start out by creating a new game attribute. To do this, select the attributes tab and click the plus sign, while editing a scene. This attribute will be used to keep track of the total score, so we’ll keep it simple by selecting integer as the type. Now, rename the attribute by double clicking on the default current name of “New Attribute” and change it to “Total Score”.
In this particular example we will soon be making the value of this attribute visible to players – however the actual name of the attribute will not be, so it’s a always good idea to be short but descriptive when coming up with attribute names.
With our newly created attribute available, all we need now is to change the logic governing treasure actors such that they trigger an update to the Total Score attribute each time the Hero scoops up a fresh piece of loot.
Pictured below is a very clear-cut method of setting up this logic. As your understanding of the GameSalad Creator improves you’ll find that your behavior combinations are often much more complex than this, but it’s important to remember that at times, simpler is better.
As you can see, we’ve added a simple Change Attribute behavior, so that when the rule triggers (ie, the Hero reaches the treasure), our attribute is increased by 100 before the treasure is removed from the scene.
Adding a Display…
Now when the Hero picks up loot, the game keeps track of it. The only trouble now is that while the game may know how much treasure has been picked up, as it stands the player does not. Which brings us to the second part of this tutorial: reporting.
The heavy lifting is already behind us on this project though, so no need to over complicate the last step. After creating a new actor named “Score Display”, we’ll add in a Display Text behavior. Open up the Expression Editor by clicking “e” icon on the right side of input field, and select the Total Score game attribute.
Before throwing the Score Display actor into the scene, let’s take a quick moment to tailor the presentation of the score. We’ll set the Alpha Color of the “Score Display” actor to 0 so the background of the actor doesn’t show up – just the score itself. Drag an instance of the Score Display actor into the scene and presto — you’re done!
Now when when previewing the project you should notice a warm feeling of achievement come over you every time you add a piece of treasure to your collection. Or at least notice that the number in the corner goes up. Results may vary!