hello i was making a simple app but encountered a problem with GAL (GraphicsGale) images i keep getting this error (invalid image handle)
her's the code :) btw i don't get this problem with bmp images
Const gwidth=640
Const gheight=480
Graphics gwidth,gheight,16,2
frame=CreateTimer(30)
AutoMidHandle True
img_hero=LoadImage("hero.gal")
img_stick=LoadImage("stick.bmp")
img_grass=LoadImage("grass.bmp")
img_fence1=LoadImage("fence1.bmp")
img_fence2=LoadImage("fence2.bmp")
If img_hero=0 Then
Print"Error Loading Image file..."
Else
If img_stick=0 Then
Print"Error Loading Image file..."
Else
If img_grass=0 Then
Print "Error Loading Image file..."
EndIf
EndIf
EndIf
nums=0
x#=40
y#=100
score=0
Repeat
Cls
DrawImage img_fence1,100,100
TileBlock img_grass
DrawImage img_hero,x,y
If KeyDown(205) Then
x=x+5
Else
If KeyDown(203) Then
x=x-5
Else
If KeyDown(200) Then
y=y-5
Else
If KeyDown(208) Then
y=y+5
EndIf
EndIf
EndIf
EndIf
If nums=0 Then
s.stick=New stick
s\x=Rand(gwidth)
s\y=Rand(gheight)
EndIf
nums=0
For s.stick=Each stick
nums=nums+1
DrawImage img_stick,s\x,s\y
If ImagesCollide(img_hero,x,y,0,img_stick,s\x,s\y,0) Then
Delete s
score=score+1
Exit
EndIf
Next
WaitTimer(frame)
Text 30,30,"Sticks Collected: " + score
Text 30,20,"Welcome To Pickin Sticks"
Flip
Until KeyDown(1)
Type stick
Field x,y
End Type
|