menu help

Blitz3D Forums/Blitz3D Beginners Area/menu help

mtnhome3d(Posted 2008) [#1]
ok i searched the forums and didn't see the problem anywere so i'm posting this. i so far have a background and three buttons. now if i click on the first one it works but if i try to use the other buttons they don't work. Not sure why though cause they were written in the same way as the first one.
 ; A 3rd person space shooter
; By R. Manwiller
; 
Type player
Field ent,x,y,z,kills,hp,score
End Type

mainmenu()
End

Function mainmenu()
Graphics 800,600,16,0
SetBuffer BackBuffer()
AutoMidHandle True
mainbg=LoadImage("media\mbg.bmp")
button1=LoadImage("media\button1.bmp")
button2=LoadImage("media\button2.bmp")
button3=LoadImage("media\button3.bmp")
mouseim=LoadImage("media\mouseim.bmp")
;MaskImage mouseim,255,255,255
Repeat 
Cls
TileImage mainbg
DrawImage button1,400,300
DrawImage button2,400,400
DrawImage button3,730,562
DrawImage mouseim,MouseX()+6,MouseY()+12

If ImagesOverlap(mouseim,MouseX(),MouseY(),button1,400,300) And MouseHit(1)
startup()


Else If ImagesOverlap(mouseim,MouseX(),MouseY(),button2,400,400) And MouseHit(1)
config()

Else If ImagesOverlap(mouseim,MouseX(),MouseY(),button3,730,562) And MouseHit(1)
End
EndIf

Flip
Until KeyHit(1)
End Function

Function config()
Cls
gw=Input("what is your screen width? ")
gh=Input("what is your screen height? ")
cd=Input("what is your color depth? ")
fileout=WriteFile ("config.dat")
WriteInt (fileout,gw)
WriteInt (fileout,gh)
WriteInt (fileout,cd)
Print "press any key to continue"
WaitKey()
End Function

Function Startup()
filein=OpenFile("config.dat")
If filein>0
gw=ReadInt(filein)
gh=ReadInt(filein)
cd=ReadInt(filein)
Graphics3D gw,gh,cd,0
Else 
Graphics3D 800,600,16,0
End If
SetBuffer BackBuffer()

End Function




JA2(Posted 2008) [#2]
Do something like:

If mousehit (1)

If ImagesOverlap(mouseim,MouseX(),MouseY(),button1,400,300)
startup()
Else If ImagesOverlap(mouseim,MouseX(),MouseY(),button2,400,400)
config()
Else If ImagesOverlap(mouseim,MouseX(),MouseY(),button3,730,562) End
EndIf

endif


mtnhome3d(Posted 2008) [#3]
thankyou so much that worked with a hitch almost it didn't like the part in slashs where it was so i moved it down a line
Else If ImagesOverlap(mouseim,MouseX(),MouseY(),button3,730,562) /End/