program problems
im having so much trouble with my program, and i need some help.
Ok, im making an RPG using directdirect draw.
I go into my battle function after walking on the world map, and it does everything right the first time. When it exits, the program quits responding, but continues to work, until it enters the fight function again, then the monster attacks. The menu pops up but it dissapears right after, and the monster attacks over and over continuously not letting the player attack at all.
This also happens if I go into the main menu from the world map. After exiting the menu it quits repsonding, and the monster does its attacks again when it enters the fight.
Why in the world does it do this? What can i try to get it to work? Any suggestions or do you need more information?
I can only guess based on the info supplied; you might need to post some code.
Anyhow, my thoughts: You are talking about the app not responding to user input after certain events happen (use a menu, attack, etc.) Do you have any particular states assigned to your input code that may cause the processing to be bypassed? I would crank out your debugger, break it in you input processing code, and repeat your bug. With a little luck and careful observation in the debugger you should be able to figure it out. I may be stating the obvious here and if I am I apologize. Hope that helps,
Sieggy
Anyhow, my thoughts: You are talking about the app not responding to user input after certain events happen (use a menu, attack, etc.) Do you have any particular states assigned to your input code that may cause the processing to be bypassed? I would crank out your debugger, break it in you input processing code, and repeat your bug. With a little luck and careful observation in the debugger you should be able to figure it out. I may be stating the obvious here and if I am I apologize. Hope that helps,
Sieggy
nope, that isnt the problem, not accepting user input and such, it does accept user input, it jsut for some reason, when i Ctrl+Alt+Delete it, it shows it isn''t responding. I came about doing this when the monster was constantly attacking. It used to be i could hit the Esc key to get it to stop, but since i took that out, it is impossible to stop until I am defeated. Let me think of what part of the code to work, because this problem spans across many many long functions.
here is a rund down of some of the code:
Fight ()
this function seeds rand() with time for some reason, but that will go away soon. then it makes sure the battle hasn''t been one. Next the timers for player one, the mosnter and if there is a player two, player twwo''s are initialized. it then draws all the fight stuff, and then goes to the function of whoever gets their time filled first.
Where the problem seems to occur is after exiting the menu on the world map, after leaving the run function and returning to the world map, and after returning to the worldmap function after winning the battle....
oh my gosh. it might be my world map function!
tell me if there is an error here.
void WorldMap(void) {
//currently not implemented, does nothing except makes a call to the
//fight program
int ENCOUNTER;//to see if you fight a mosnter or not
LPDIRECTDRAWSURFACE background;
RECT rect_background = {0,0,640,480};
BITMAP_FILE16 bitmapfile16;
Load_Bitmap_File16(&bitmapfile16, "WORLDMAP.BMP"); //Load the Background Bitmap
Load_Frame_Surface16(background,&bitmapfile16,0,0,640,480,0,false);//Load Bitmap onto surface
Unload_Bitmap_File16(&bitmapfile16);
lpddsback->Blt(▭_background, background,▭_background,(DDBLT_WAIT ),NULL);
Set_Pos_BOB(&player1,200,200);
Set_Pos_BOB(&player1,200,200);
while(1) {
MTIMER=0;
lpddsback->Blt(▭_background, background,▭_background,(DDBLT_WAIT ),NULL);
Animate_BOB(&player1);
Draw_BOB(&player1,lpddsback);
if(KEY_DOWN(VK_SHIFT)) {
Main_Menu();
WorldMap();
}
if(KEY_DOWN(VK_UP)) {
player1.y-=5;
Draw_BOB(&player1,lpddsback);
ENCOUNTER=rand()%100;
if(ENCOUNTER>90) {
win_battle=0;
BATTLE_STATE=2;//set number of players in battle
BACK=2;
MONSTER_NUMBER=1;
Set_Pos_BOB(&player1,500,200);
Fight();
}//end if
}//end if
else if(KEY_DOWN(VK_DOWN)) {
player1.y+=5;
Draw_BOB(&player1,lpddsback);
ENCOUNTER=rand()%100;
if(ENCOUNTER>90) {
win_battle=0;
BATTLE_STATE=2;//set number of players in battle
BACK=2;
MONSTER_NUMBER=1;
Set_Pos_BOB(&player1,500,200);
Fight();
}//end if
}//end if
else if(KEY_DOWN(VK_LEFT)) {
player1.x-=5;
Draw_BOB(&player1,lpddsback);
ENCOUNTER=rand()%100;
if(ENCOUNTER>90) {
win_battle=0;
BATTLE_STATE=2;//set number of players in battle
BACK=2;
MONSTER_NUMBER=1;
Set_Pos_BOB(&player1,500,200);
Fight();
}//end if
}//end if
else if(KEY_DOWN(VK_RIGHT)) {
player1.x+=5;
Draw_BOB(&player1,lpddsback);
ENCOUNTER=rand()%100;
if(ENCOUNTER>90) {
win_battle=0;
BATTLE_STATE=2;//set number of players in battle
BACK=2;
MONSTER_NUMBER=1;
Set_Pos_BOB(&player1,500,200);
Fight();
}//end if
}//end if
DD_Wait_For_Vsync();
DD_Flip();
}//end while
}//end function
very crude i admit it, this is the only function i haven''t even done a work thorough yet to make sure everything works. Its the most crude of all my functions.
Any other info:
I use andre'' lamothes GPDUMB engine, but i have made changes...i use 16 bit bitmaps and 16 bit bobs...hope someone can help here.
here is a rund down of some of the code:
Fight ()
this function seeds rand() with time for some reason, but that will go away soon. then it makes sure the battle hasn''t been one. Next the timers for player one, the mosnter and if there is a player two, player twwo''s are initialized. it then draws all the fight stuff, and then goes to the function of whoever gets their time filled first.
Where the problem seems to occur is after exiting the menu on the world map, after leaving the run function and returning to the world map, and after returning to the worldmap function after winning the battle....
oh my gosh. it might be my world map function!
tell me if there is an error here.
void WorldMap(void) {
//currently not implemented, does nothing except makes a call to the
//fight program
int ENCOUNTER;//to see if you fight a mosnter or not
LPDIRECTDRAWSURFACE background;
RECT rect_background = {0,0,640,480};
BITMAP_FILE16 bitmapfile16;
Load_Bitmap_File16(&bitmapfile16, "WORLDMAP.BMP"); //Load the Background Bitmap
Load_Frame_Surface16(background,&bitmapfile16,0,0,640,480,0,false);//Load Bitmap onto surface
Unload_Bitmap_File16(&bitmapfile16);
lpddsback->Blt(▭_background, background,▭_background,(DDBLT_WAIT ),NULL);
Set_Pos_BOB(&player1,200,200);
Set_Pos_BOB(&player1,200,200);
while(1) {
MTIMER=0;
lpddsback->Blt(▭_background, background,▭_background,(DDBLT_WAIT ),NULL);
Animate_BOB(&player1);
Draw_BOB(&player1,lpddsback);
if(KEY_DOWN(VK_SHIFT)) {
Main_Menu();
WorldMap();
}
if(KEY_DOWN(VK_UP)) {
player1.y-=5;
Draw_BOB(&player1,lpddsback);
ENCOUNTER=rand()%100;
if(ENCOUNTER>90) {
win_battle=0;
BATTLE_STATE=2;//set number of players in battle
BACK=2;
MONSTER_NUMBER=1;
Set_Pos_BOB(&player1,500,200);
Fight();
}//end if
}//end if
else if(KEY_DOWN(VK_DOWN)) {
player1.y+=5;
Draw_BOB(&player1,lpddsback);
ENCOUNTER=rand()%100;
if(ENCOUNTER>90) {
win_battle=0;
BATTLE_STATE=2;//set number of players in battle
BACK=2;
MONSTER_NUMBER=1;
Set_Pos_BOB(&player1,500,200);
Fight();
}//end if
}//end if
else if(KEY_DOWN(VK_LEFT)) {
player1.x-=5;
Draw_BOB(&player1,lpddsback);
ENCOUNTER=rand()%100;
if(ENCOUNTER>90) {
win_battle=0;
BATTLE_STATE=2;//set number of players in battle
BACK=2;
MONSTER_NUMBER=1;
Set_Pos_BOB(&player1,500,200);
Fight();
}//end if
}//end if
else if(KEY_DOWN(VK_RIGHT)) {
player1.x+=5;
Draw_BOB(&player1,lpddsback);
ENCOUNTER=rand()%100;
if(ENCOUNTER>90) {
win_battle=0;
BATTLE_STATE=2;//set number of players in battle
BACK=2;
MONSTER_NUMBER=1;
Set_Pos_BOB(&player1,500,200);
Fight();
}//end if
}//end if
DD_Wait_For_Vsync();
DD_Flip();
}//end while
}//end function
very crude i admit it, this is the only function i haven''t even done a work thorough yet to make sure everything works. Its the most crude of all my functions.
Any other info:
I use andre'' lamothes GPDUMB engine, but i have made changes...i use 16 bit bitmaps and 16 bit bobs...hope someone can help here.
ok, I figured something else about it now, as soon as it enters the fight program it stops responding, and if you go into the menu it doesn''t stop responding, but as soon as you return to the world map. Why!!??!! grr I wish this would work.
quote: Original post by Ferinorius
ok, I figured something else about it now, as soon as it enters the fight program it stops responding, and if you go into the menu it doesn''t stop responding, but as soon as you return to the world map. Why!!??!! grr I wish this would work.
This bit sounds like you don''t process Windows messages (much) during a fight - that''s how the system determines if an application is responding or not.
As for the rest of your problems, I''d say that you''re not updating/checking your variables properly.
TheTwistedOne
http://www.angrycake.com
TheTwistedOnehttp://www.angrycake.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement