Search The Glog

Saturday, August 17, 2013

Awards system for Gamemaker games

This is the awards (achievement) system I used in my recent games, Trapped and PushIt. It is very simple, as it uses only one object, one scripts, one global variable, and can show multiple achievements, as shown in the picture below.

Awards system of GameMaker

First you need to create a global variable at the game initialization store the awards, global.awards='0000000000'. It uses 10 zeros as in this example there are 10 awards. Also we need the sc_award_text(award) script to set the awards text. The script has one argument, the award number (0...10):
var text='';
switch (argument0) {
case 1: text='First award';break;
case 2: text='Another award';break;
case 3: text='Yet another award';break;
case 4: text='Fourth award';break;
case 5: text='And so on...';break;
case 6: text='Test 6';break;
case 7: text='Test 7';break
case 8: text='Test 8';break;
case 9: text='Test 9';break;
case 10: text='Test 10';break; }
return text;