Proxemit - which I've destroyed some months ago, after applying changes and fixes from playtest #1, now works. Somehow it is impossible to recreate the fatal bug, so I'll calmly look the other way, and ignore my hunches about what and where it was. Fingers crossed that it'll stay on the other side of the river... Shouts* Laughs*
Anyway, let's talk about how I save progress in Proxemit!
I'm saving everything in small ini files. Hush hush. I know ~ you don't have to tell me, but please do if you absolutely must, I'd love to hear how to do it properly.
So every orb you pick up, tells the game to open an ini file, then look up the orb by adding together the orbs x and y coordinates only to use it as a sort of unique ID. Every ID is stored under the levels individual ID, so some orbs might have the same specific ID, but combined with the level ID, no orb will share the same.
An orb in level_1 placed at 400x, 500y, will then be easy to find by going through the ini (the ini read command does this automatically) to locate the section which is called [1] - for level_1. Then the game will check for an ID called 400500 and see if it is equal to 1. If it is 1 the orb will be deleted and a "dead orb" will be placed in it's spot. If it does not exist in the ini, the game will register it, for later use. When first registered the orb will get the value of 0. So it does exist in the database, but it has yet to be collected by the player.
I do the same with exits. When an exit has been activated it's variable "open" will be set to 1. Then when a level ends by the player going to the next/previous, a special "level end" event will register in the Exits.ini if the exit is open or not.
The reason I do it this way is to effectively make the objects register them selves, and leave me out of it. I love the fact that, with code, this is possible. Every object that needs registration has been programmed to do this. Gamemaker is a trooper when it comes to these kind of things, because it has the ability to check an ini, if it doesn'e exist, it creates it. The same goes for the "posts" inside an ini. It creates them if they do not exist.
~ ~ ~
Ingen kommentarer:
Send en kommentar