Achievements are becoming quite popular in Flash games (eg. Amorphous+ ). These are most likely influenced by Xbox’s Achievements and PS3 Trophies, or possibly Kongregates Badges. If your a Flash game developer and want a quick little 7 line function that will let you do this, then here’s how you do it.

Most importantly, you’ll need your variables to check for badges. Start off with this(Or whatever variables you wish to use).

var 10Kills:Boolean = false;

var 50Kills:Boolean = false;

var 1000Kills:Boolean = false;

Next, this is the code for the function you will use.

function Achievement(achName, achDescript, achVariable) {
if (achVariable == false) {
achBox.gotoAndPlay(2);
achBox.boxName.text = achName;
achBox.boxDescript.text = achDescript;

achVariable = true;
}
}

Now, you need your Achievements graphic. Heres mine.

Put your graphics for yours in it’s owned MovieClip. Leave the first frame blank, with stop(); on it. Have your graphic on the second frame, going on as long as you want it to stay visible for.

On the movieclip have two dynamic textbox’s. Give the one for the instance name of “boxName” and the one for the description the instance name of “boxDescript”.

Go back to the main timeline and drag your achievement box movieclip onto the stage where you want it to appear. Give it the instance name of “achBox”

Now, whenever you want the achievement box to appear, you use this line of code

Achievement(”AchieveName”, “AchieveDescription”, varName);

You should be able to figure out what you need to change to make it work for your achievement. For me, I what use “_root.10Kills” for varName. Good luck!