I Wanna Community

Fangames => Game Design => Programming Questions => Topic started by: Realtime911 on May 15, 2015, 05:45:13 AM

Title: Achievement System
Post by: Realtime911 on May 15, 2015, 05:45:13 AM
Can somebody teach how to make Achievement Systems like in K3?
Any help is appreciated!
Title: Re: Achievement System
Post by: lawatson on May 15, 2015, 03:15:21 PM
I think you can do something like that with save data. What I would suggest to start with is in the saving/loading scripts, make lines like:

file_bin_write_byte(f,global.achievement[0]);
file_bin_write_byte(f,global.achievement[1]);

That'll make global.achievement into an array so that it has the same variable but with multiple values attached to it.

To load it, do stuff like:

global.achievement[0] = file_bin_read_byte(f);
global.achievement[1] = file_bin_read_byte(f);

Make sure to put each one at the end of the script but before it stops reading the file.

For drawing it, I would suggest a sprite for each achievement(You can do a single sprite but use image/index, of course.)
Make an object for each achievement and have it draw the sprite if global.achievement[achievement number] = 1.

That's how I would do it. Good luck!
Title: Re: Achievement System
Post by: Realtime911 on May 15, 2015, 09:25:05 PM
It workss!, thank you Lawatson!