ERROR

BlitzPlus Forums/BlitzPlus Beginners Area/ERROR

Newcomer(Posted 2008) [#1]
there is a large error in my game already!
in my main function it shows "invalid image handle" whenever it get to the drawing of the images, I've tryed everything i can think of to stop it but nothing works!!!

Function BeginGame()
leave = 0
Local image1 = LoadImage("MainGameMenu.bmp")
Local image2 = LoadImage("Button1.bmp")
Local image3 = LoadImage("Button2.bmp")
While Not leave
Cls
DrawImage image1,400,300
DrawImage image2,400,300
DrawImage image3,400,300
Flip
Delay 200
Wend
End Function

p.s. while debuging I noticed that the images were always saved as 0 as opposed to a long string of numbers


KillerX(Posted 2008) [#2]
Make sure the images are saved with the code, and that the names are correct. (No spelling mistakes)


Newcomer(Posted 2008) [#3]
ok I even saved them like 50 times and copy and pasted names off of my paint program...


GfK(Posted 2008) [#4]
Run this, and check the debug log. If you have an image that shows a zero, that's where the problem is.
Function BeginGame()
leave = 0
Local image1 = LoadImage("MainGameMenu.bmp")
Local image2 = LoadImage("Button1.bmp")
Local image3 = LoadImage("Button2.bmp")

;debug stuff
DebugLog "Image 1 = " + image1
DebugLog "Image 2 = " + image2
DebugLog "Image 3 = " + image3
Stop

While Not leave
Cls
DrawImage image1,400,300
DrawImage image2,400,300
DrawImage image3,400,300
Flip
Delay 200
Wend
End Function