Loadanim/drawanim bug

Previous topic - Next topic

FutureCow

It took me a while to find what appears to be crashing my game in progress.

I had the following :-
LOADANIM "xyz.png",1,100,25
DRAWANIM 1,0,PlayerX,PlayerY

Which worked as expected (my png file had 3 frames in it and was 100 x 75 in total size).

I did some modifications to the png file, and ended up making the file smaller than what LoadAnim had in the command. (eg, the end size of xyz.png was 80x20).
The loadanim didn't cause any problems (which I think it should have).
When it tries to do the drawanim command now it crashes the program with
programname.exe has encountered a problem and needs to close.  We are sorry for the inconvenience.

Thoughts?

Moru

Activate debugging first of all, if the program crashes like that you are not running in debugging mode.

My thought is that the program is crashing because of trying to do what you tell it to do :-)

On the other hand this is basic so it's supposed to inform you clearly of what you are doing wrong since this is a language for beginners.

FutureCow

I did turn on debug, it doesn't do anything. The program window opens then closes again and goes straight back to the IDE. The debug pane on the right hand side remains empty.

So unless I'm missing a vital step in how you run your program in debug (other than "Toggle Debug Mode on" then "Build" and "Run") , debug has a bug too.

Moru

Yes but this is where GLBasic should tell you the error, now we have the real bug :-)

FutureCow

My dodgy code available on request  :P

Kitty Hello

post the image, or at least the image size you use.

Moru

The image size was 80x20 as stated in the first post and I tried it with a png created in photoshop 7 and get the same error. (no error in debug, just exit program, runtime error if I turn off debug)

FutureCow

I've attached the image but as per Moru's post, it seems to happen with any image (at least, any png image). I've just tried it with a 4x9 png file that I loaded with LOADANIM "propeller.png",5,5,9 - the same fault occurs - so it seems to happen regardless of the size.

The 4x9 image is attached. This is the code that will break.
Code :
Code (glbasic) Select

SETSCREEN 1024,768,0
LOADANIM "propeller.png",5,5,9
DRAWANIM 5,0,1,1 // Propeller
SHOWSCREEN
END



[attachment deleted by admin]

Kitty Hello

Yikes!!!
Only one line, and a few pixels left crashed. I've fixed it for the next update.
So far, make the image a bit taller, to force 2 lines.

FutureCow

Are you saying that, for example, if I have a png with 2 animation frames in it that they should always be drawn like

**
**

rather than

**  **

in the file?

Kitty Hello

get an update, it's fixed now.