Fangames > Programming Questions

Achievement System

(1/1)

Realtime911:
Can somebody teach how to make Achievement Systems like in K3?
Any help is appreciated!

lawatson:
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!

Realtime911:
It workss!, thank you Lawatson!

Navigation

[0] Message Index

Go to full version