title menu

Blitz3D Forums/Blitz3D Beginners Area/title menu

I would suggest creating a little function like (totally untested and off the top of my head!):
function clickbox(image,x,y)
     drawimage image,x,y
     xw=imagewidth(image)
     yw=imageheight(image)
     if mousedown(1) and mousex()>=x and mousex()<=x+xw and mousey()>=y and mousey()<=y+yw then return true else return false
     end function
This way you'd then call:
if clickbox(start_game_image,20,20) then start_game
To take it a step further...
Function clickbox(off_image,on_image,x,y)
     xw=ImageWidth(on_image)
     yw=ImageHeight(on_image)
     If MouseX()>=x And MouseX()<=x+xw And MouseY()>=y And MouseY()<=y+yw
          DrawImage on_image,x,y
          If MouseDown(1) Then Return True
          Else
          DrawImage off_image,x,y
          Return False
          EndIf
End Function
This will then light up the image (on_image) if you run the mouse over it, and return true when it's clicked, otherwise it will display off_image and return false.

This sort of thing just makes drawing screens really easy and quick as you're drawing and checking all at the same time.

Of course all this can be optimised a lot, as I said this was all off the top of my head, you'd probably want drawblock instead of drawimage for example... anyway, I hope this helps.