an example of a simple game
Mecrenary: it was very easy to make. i get a lot of questions on how long it takes to develop code X, so i have started rating them by the number of 12 packs i drank while writing it. this took about 1.5 12 packs altogether. most of this was looking for and formatting the graphics. the skeletal version was up and going very quickly though.
benryves & Mercanry: if you like game programming you should at least be familiar with C. though assembly is a good skill to IMHO.
Firenet: yes, a friend noticed this glitch way back when i first got this done. i developed it on XP, and GDI works somewhat differently than 98/Me. as a result the 98/Me users may have the non erased background glitch. if i get a chance i may go fix it, but i no longer have anything running those classics to test it on...
benryves & Mercanry: if you like game programming you should at least be familiar with C. though assembly is a good skill to IMHO.
Firenet: yes, a friend noticed this glitch way back when i first got this done. i developed it on XP, and GDI works somewhat differently than 98/Me. as a result the 98/Me users may have the non erased background glitch. if i get a chance i may go fix it, but i no longer have anything running those classics to test it on...
Quote:Original post by FireNet
Way ta go buddy.[cool]
Btw it dont work very well on my comp.It's runs on Windows ME.Here's a screenshot.I ran it a couple of times but there were huge flashes and flickering
But your code is all nicely formated and commented.Very good job on that.I dont really know why it's looking messed up on my comp.
The same here on Win 98 SE.
ok, i fixed the non erasing for those of you who have older versions of windows (hopefully, like i said, i can't tell for sure). i'm also working on a classic RPG type example. let me know if you guys have any more problems.
You might want to consider...
Changing this
To this
If loadlevel ever returns false, you should quit the game since there isn't any more levels (or do something to signify the end of the game, e.g. game over). Otherwise it will keep attempting to load levels 'forever'...
[Edited by - Programmer One on September 9, 2004 2:58:48 AM]
Changing this
void loadLevel(char * filename){ koopa[0].lives = 0; FILE * level = fopen(filename, "r"); if (level==NULL)MessageBox(NULL, "Error Loading file", filename, MB_OK); for(int y = 0; y < 15; y++) { for(int x = 0; x < 20; x++) { map[x][y] = fgetc(level); if(map[x][y] == '@') { koopa[koopa[0].lives].x= x*32; koopa[koopa[0].lives].y= y*32; koopa[0].lives++; } if(map[x][y] == 'M') { player.start_x = x*32; player.start_y = y*32; player.x = player.start_x; player.y = player.start_y; } } fgetc(level); //get rid of unwanted '\n' } fclose(level);}
To this
bool loadLevel(char * filename){ koopa[0].lives = 0; FILE * level = fopen(filename, "r"); if (level==NULL) return false; for(int y = 0; y < 15; y++) { for(int x = 0; x < 20; x++) { map[x][y] = fgetc(level); if(map[x][y] == '@') { koopa[koopa[0].lives].x= x*32; koopa[koopa[0].lives].y= y*32; koopa[0].lives++; } if(map[x][y] == 'M') { player.start_x = x*32; player.start_y = y*32; player.x = player.start_x; player.y = player.start_y; } } fgetc(level); //get rid of unwanted '\n' } fclose(level); return true;}
if(keys[VK_UP]) { if(map[current_x][current_y] == 'D') { player.level++; char buffer[256]; wsprintf(buffer, "level%i.txt", player.level); if (!loadLevel(buffer)) player.lives = 0; return; } if(map[current_x][current_y] == 'H' || map[current_x][current_y+1] == 'H') { player.y-=2; player.climbing=true; player.jumping=false; player.climb = !player.climb; return; } else player.climbing = false; }
If loadlevel ever returns false, you should quit the game since there isn't any more levels (or do something to signify the end of the game, e.g. game over). Otherwise it will keep attempting to load levels 'forever'...
[Edited by - Programmer One on September 9, 2004 2:58:48 AM]
thanks, P1, i actually just went ahead and setup the completion of the last present level to be the "win" condition. you can still add all the levels you want with a text editor.
i didn't realize it, but i thought i had taken out the last door (hadn't even looked at the code in a year). i was wondering why eveyone was having the level loading prob :P
i also added "Esc" to quit the game, and the 98/Me issues should be fixed.
i didn't realize it, but i thought i had taken out the last door (hadn't even looked at the code in a year). i was wondering why eveyone was having the level loading prob :P
i also added "Esc" to quit the game, and the 98/Me issues should be fixed.
Quote:Original post by anist
i don't know about loadrunner, but i have a simular blackjack game i may post, and was thinking of doing a simple "Legend of Zelda" type game if anyone was interested. the real challenge here would to be to keep it simple and illustrate the concepts, as opposed to putting in too much and making it useless for newbs to learn from.
Hey those would be very cool to see.
Can somebody mirror this file? I just can't seem to get it. Thanks.
And yes, please do an RPG example. Many people here would be happy.
And yes, please do an RPG example. Many people here would be happy.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement