Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Simple Game C++

Name: Kellex 2013-07-17 10:07

Hello, i got a simple question, im making a C++ console game, and i got a whole function(void) for each map of the levels, and they look very similar. in the source code the functions have these names...

m1();
m2();
m3();
m4();

if you look the differences between each void you look it only changes a few times the char of each map, like char Map, char Map2 etc...

I want to make just a void for all maps, and that some other variable changes the Map each time a map is loaded......

Also i think it would work to put an int between a line like this

char Map"here should goes the int"[10][10];

that way i just change the int value in every map loading to make it work......

Thanks

Name: Anonymous 2013-07-18 12:12

by the way,
                // Goal
            else if (Map.data[py2][px2] == '-') {
                    // Quit game loop if out of maps
                if (Level + 1 >= sizeof(Maps) / sizeof(*Maps))
                    break;
                    // Go to next map
                SetMap(Level + 1);
            }

needs to be
                // Goal
            else if (Map.data[py2][px2] == '-') {
                    // Quit game loop if out of maps
                if (Level + 1 >= sizeof(Maps) / sizeof(*Maps))
                    break;
                    // Go to next map
                SetMap(Level + 1);
                DrawMap();
                continue;
            }

and

            // Initialize vairables
        Hp = HpStart;

needs to be


            // Initialize vairables
        Hp = HpStart;
        Keys = 0;

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List