Quote: "It's nice to see someone learning a programming language the good way ."
Of course. Appreciate the help; however, for my purposes I think Grueslayer's method would be more applicable.
Quote: "The easiest way is to have one large image for all the normal button looks (the way the screen would look without anything selected). Only show the button changes when the mouse is over the menu selection rather than flipping between two images for each selection all the time."
So then in order to have another menu you would just change the title image I take it?
Would it be more versatile (and perhaps quicker) to place the code in a function?
perhaps:
function Menu(menuID, buttonIDstart, buttonIDend, x, y)
` Show the background
paste image menuID,0,0
` Go though each menu selection image
for t= buttonIDstart to buttonIDend
` Check if the mouse is on the menu selection
if mousex()=>x and mousey()=>y and mousex()<=x+image width(t) and mousey()<=y+image height(t)
` Show the current selected image
paste image t,x,y,1
endif
` Go to the next menu selection
inc y,88
next t
endfunction
functionally it does the same process, but it would seem more expandable from the function?
EDIT:
Well, toying around with it I figured out how to add a clicked state; however, now how would I make it so that it doesn't allow you to hold the mouse down and clicks other things at the point clicked (see example)
set display mode 800,600,32
global menuselect as integer
` Load the main title screen
load image "Title.png",1,1
load image "Title2.png",8,1
` Load each selected text
load image "Menu1Select.png",2,1
load image "Menu2Select.png",3,1
load image "Menu3Select.png",4,1
`Load down state text
load image "Menu1click.png",5,1
load image "Menu2click.png",6,1
load image "Menu3click.png",7,1
sync on
do
if menuselect = 0
Menu( 1, 2, 4, 5, 7, 316, 201)
endif
if menuselect = 1
Menu( 8, 2, 4, 5, 7, 316, 201)
endif
sync
loop
function Menu(menuID, overIDstart, overIDend, downIDstart, downIDend, x, y)
`set local y value to check for clicked images
local resety as integer : resety = y
`set values for error check
local imgid$ as string : imgid$ = ""
local stateis$ as string : stateis$ = ""
local info$ as string : info$ = ""
local noselect$ as string : noselect$ = "Menu item You are in menu 0."
` Show the background
paste image menuID,0,0
` Go though each menu selection image
for t= overIDstart to overIDend
` Check if the mouse is on the menu selection
if mousex()=>x and mousey()=>y and mousex()<=x+image width(t) and mousey()<=y+image height(t) and mouseclick() = 0
` Show the current selected image
paste image t,x,y,1
imgid = t - 1
imgid$ = str$(imgid)
stateis$ = " is not clicked. "
endif
` Go to the next menu selection
inc y,88
next t
`reset y for clicked images
y = resety
`go through each clicked menu image
for u= downIDstart to downIDend
`Check if mouse is on and clicking menu item
if mousex()=>x and mousey()=>y and mousex()<=x+image width(u) and mousey()<=y+image height(u) and mouseclick() = 1
`Show the clicked image
paste image u,x,y,1
imgid = u - 4
imgid$ = str$(imgid)
stateis$ = " is clicked. "
if u < 7
menuselect = u - 5
endif
endif
`Next menu item
inc y,88
next u
`error checking
info$ = "Menu item " + imgid$ + stateis$ + "You are in menu " + str$(menuselect) + "."
`won't display worthless text
if info$ <> noselect$
`centers text below title header
text ((screen width() / 2) - (text width(info$) / 2)), 100, info$
endif
endfunction menuselect
Media attached.
If at first you dont succeed, LOWER YOUR STANDARDS.