Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Help with bomb creating in my bomberman.

This thread is locked; no one can reply to it. rss feed Print
 1   2 
Help with bomb creating in my bomberman.
Kauhiz
Member #4,798
July 2004

Yet another array overflow ::)

---
It's Ridge Racer! RIIIIIDGE RAAAAACER!

Lostforever
Member #7,253
May 2006

Yep, sorry for forgeting xD I did fix that part and it still gives the same bug, so the mistake is elswere.

Cheers!! *^_^*

_v3n0w_
Member #7,570
July 2006

Look.... Im doing a bomberman game.

If i put a bomb: colisao_bomba=1; //show that the bomber is on the bomb. (last bomb) and look that he cant put another bomb if he is on a bomb

and than...

1if(numero_bombas>=1){ //if has bomb on the game.
2 if(colisao_bomba==1){ //if the bomber is on the bomb.
3 colisao_bomba = colisao(image1_bb_left, image1_bb_top
4 ,image1_bb_right , image1_bb_bottom, bombax[numero_bombas], bombay[numero_bombas]); //if bomber is still on the bomb, colision will
5 //be 1, if not, collision is 0;
6 }
7 }
8 
9 
10 
11if(numero_bombas>=1){
12 if(colisao_bomba==0){ //bomber is not on the bomb.
13 for(i=1;i<=numero_bombas;i++){ //colission after bomber go out of the bomb
14 if(collision==0) collision = colisao(image1_bb_left, image1_bb_top, image1_bb_right, image1_bb_bottom,
15 bombax<i>, bombay<i>);
16 }
17 }
18 }

Lostforever
Member #7,253
May 2006

I can see what you mean v3n0w, but still, Ive made the move function to check the surrounding cells so it really doesn't (or din't ought to anyhow) matter what kind of cell the player is on in any given moment...

Wait a sec, just had an idea... But it still doesn't acount for him not being able to lay any more bombs.

[Edit] Oks, Idea failed ::)

_v3n0w_
Member #7,570
July 2006

Man... give a look at my bomberman.

http://rapidshare.de/files/27803842/Dev-Cpp.rar.html

Can i see yours? :)

Lostforever
Member #7,253
May 2006

Shure, though you've made my bomberman look a little... unfinished, let's leave it at that xD

If you can find what the bug is in my code, you get the whole cookie jar :)
I've atached the whole project.

PS: Your bomberman looks fabulous!

_v3n0w_
Member #7,570
July 2006

I dont know class, its hard to me find a bug there...
And i was thinking that u was using collision...

thank u and keep your good work ;)

Lostforever
Member #7,253
May 2006

O, well, thanks for trying. If anyone else finds what the hell is wrong...
Please warn me ^^

[Edit]

And I was right, its something to do with memory management,if you add the folowing 2 lines in the main funcition, just before drawing the buffer:

// textprintf_ex(buffer, font, 10, 40, makecol(255, 0, 200), -1, "State of cell inicial: %d", mapa.celda[19][17].estado);
// textprintf_ex(buffer, font, 10, 100, makecol(255, 0, 200), -1, "State of cell superior: %d", mapa.celda[19][16].estado);

It hangs the program as soon as you try to set a bomb, about 9 out of 10 times. What is more, if've just found proof that it has something to do with it XDDD Half of my keyobord suddently and suspìciously got blocked, for example, shift + numbrer and the arrow keys wont work as I tipe XD thats why I dint put the above lines in a code tag, couldnt close it cause I can't write the slash.

This proves 2 things
a) memory messup
b) its a bug with a sense of humor.

Sooo if anyone sees what I can't spot either cause I need glases or cause I dont know much about memory, new, delete, pointers and so on, please tell :P

 1   2 


Go to: