Maps+Mini-Maps

You must understand the Game Editor concepts, before post here.

Maps+Mini-Maps

Postby RippeR7420 » Sun Oct 27, 2013 4:43 pm

What method do you use for making maps/mini maps?

I'm currently kind of stuck on this, And the method I am attempting to use seems really long and redundant.

I would love to hear how you guys do/have done it!
CURRENT PROJECTS:

-Olo: The Sword Shaman http://game-editor.com/forum/viewtopic.php?f=4&t=12919

-The Wrath of Blob: (On the back burner)

-StickMcGee - Blast to the Future http://game-editor.com/forum/viewtopic.php?f=4&t=13660
User avatar
RippeR7420
 
Posts: 391
Joined: Mon Apr 27, 2009 4:16 pm
Location: Salt Lake City, Utah.
Score: 23 Give a positive score

Re: Maps+Mini-Maps

Postby AliceXIII » Sun Oct 27, 2013 5:16 pm

Well how are you doing it?

Anyways i just save binary data using structs.

This is my Object struct just handles basic stuff for now but can easily expanded in the future
Code: Select all
struct OBJECT
{
    int ox;
    int oy;
    int oAnim;
    int flag;
};


Here is the save and load functions for writing and reading the data
Code: Select all
void loadLvl(char* LoadSaveTag)
{
    int j;
    struct OBJECT o[LevelSize];
    FILE * lvlF;
    lvlF=fopen(LoadSaveTag, "rb");
 
    if(lvlF)
    {
        fread(o, sizeof(o), 1, lvlF);
 
        for(j=0; j<LevelSize-1; j++)
        {
            if(o[j].flag==1)
            {
                CreateActor("Object", "ObjectSet", "(none)", "(none)", 0, 0, true);
                object=getclone2("Object", j);
                object->x=o[j].ox;
                object->y=o[j].oy;
                object->animpos=o[j].oAnim;
            }
            else
            break;
        }
    }
    free(o);
    fclose(lvlF);
}
void saveLvl(char* LoadSaveTag)
{
    int j;
    struct OBJECT o[LevelSize];
    FILE * lvlF;
    lvlF=fopen(LoadSaveTag, "wb");
 
    if(lvlF)
    {
        for(j=0; j<oACTORCOUNT; j++)
        {
            object=getclone2("Object", j);
            o[j].ox=object->x;
            o[j].oy=object->y;
            o[j].oAnim=object->animpos;
            o[j].flag=1;
        }
        fwrite(o, sizeof(o), 1, lvlF);
    }
    free(o);
    fclose(lvlF);
}


I just grab the x y and animpos from the objects when i open the save and load menu in my map maker, i store them in the struct and save them to an external file so i can read back later.

If you have trouble understanding let me know!
"Taking a breath of fresh air."
User avatar
AliceXIII
 
Posts: 325
Joined: Fri Sep 17, 2010 2:36 am
Location: victoria, texas
Score: 37 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest

cron