|
Why is stretch_sprite( ) crashing?? |
Matt Kindy
Member #7,331
June 2006
|
Why does this crash my program? |
Richard Phipps
Member #1,632
November 2001
|
Are map and your PA arrays the same colour depth? |
Matt Kindy
Member #7,331
June 2006
|
yes., check updated code. |
ReyBrujo
Moderator
January 2001
|
Compile in debug and see the variables to known which one is causing the crashes. -- |
Matt Kindy
Member #7,331
June 2006
|
none are causing the crash... I have identical functions except for dir and they work fine, but I know that dir isn't causing the crash, because I changed it to the same as another, it still crashes... EDIT: when i comment out stretch_sprite, it works, but of course, the sprite is not displayed so... |
Richard Phipps
Member #1,632
November 2001
|
sprintf(char_bmp_name,".\\PaladinAtk\\PAD%d%d.bmp", dir, num); PA[0/*(dir)*/][0/*(num)*/] = load_bitmap(char_name_str,NULL); You are using char_bmp_name there, and then char_name_str. Is char_name_str correct? also where are you creating or loading map in your code? |
Matt Kindy
Member #7,331
June 2006
|
oops, sorry, typed it wrong in here, they are both char_bmp_name
|
Richard Phipps
Member #1,632
November 2001
|
You have error checked the load_bitmap to make sure the result is not NULL? why do you have \\ in the sprintf? |
Matt Kindy
Member #7,331
June 2006
|
THe '\\' is the equivalent of a single backslash, but C sees a single backslash as part of an escape sequence like, '\n', so you put \\ for files (i.e. "C:\\Program Files\\Game.exe"), the '.' means the 'current directory'. |
Richard Phipps
Member #1,632
November 2001
|
Hmm.. I didn't know that. I just normally use a single / slash. |
Matt Kindy
Member #7,331
June 2006
|
well, draw_sprite is doing it too..., hold on and blit() |
Richard Phipps
Member #1,632
November 2001
|
add: |
Matt Kindy
Member #7,331
June 2006
|
it's not loading... I just rechecked it, so why wouldn't it be loading? |
Richard Phipps
Member #1,632
November 2001
|
Either the file path is wrong, or the image is in the wrong format. I asked if you checked for the load_bitmap working earlier on.. |
Matt Kindy
Member #7,331
June 2006
|
sorry OH MY GOSH! :o:o:o Thank you! |
Richard Phipps
Member #1,632
November 2001
|
|
Matt Kindy
Member #7,331
June 2006
|
I might have one more question for you, so stay here for a min please EDIT: ok
|
Richard Phipps
Member #1,632
November 2001
|
Matt Kindy
Member #7,331
June 2006
|
I prechecked this one and it's not loading either, however, in this case, it is named correctly.(At least I'm 90% sure...) |
Richard Phipps
Member #1,632
November 2001
|
You could do with adding some logging code to your project. Then you could write out more detailed error messages and information to a text file and track down the problem easier. It might be you have an image as 405 instead of 45, or something like that.. |
Matt Kindy
Member #7,331
June 2006
|
. These are the images... I don't think they do. |
Richard Phipps
Member #1,632
November 2001
|
Sorry, I've got to go now. Maybe someone else can help you figure this one out! |
Matt Kindy
Member #7,331
June 2006
|
THanks for all your help! |
LennyLen
Member #5,313
December 2004
|
Change: for(dir=0; dir<14; dir+=2)
|
|