Ok, I've added rollovers to this code. So now it takes 2 images, each containing 3 instances of "+" and "-", respectively. I'll update the media, so you can see how I worked it with my buttons.
Code:
Rem Project: buttons
Rem Created: 10/18/2006 4:51:10 PM
Rem by Dracula: aka J. Keyes
Rem ***** Main Source File *****
set display mode 800,600,32
Co=RGB(240,255,35):ink co,1
clickon=-1
rollover=0
sync rate 0
sync on
`*************************
`load pluses
`pluses=image 50-59 (58=clicked; 59=rollover)
load image "button_plus_40x19.png",1,1
paste image 1,0,0
for n=30 to 37
x=0
get image n+20,x,0,19,19
sprite n,0,0,1 `30-37 = plus sign (blurry)
next n
get image 58,20,0,39,19 `clicked
sprite 38,20,0,1
get image 59,40,0,59,19 `rollover
sprite 39,40,0,1
`load collision sprite
get image 1000,0,0,1,1
sprite 1000,1,1,1000
delete image 1
`load minus images
`minuses=60-69 (68=clicked; 69=rollover)
load image "button_minus_40x19.png",1,1
paste image 1,0,0
for n=40 to 47
x=0
get image n+20,x,0,19,19
sprite n,0,0,1 `30-37 = plus sign (blurry)
next n
get image 68,20,0,39,19 `clicked
sprite 48,20,0,1
get image 69,40,0,59,19 `rollover
sprite 49,40,0,1
delete image 1
`*****************main loop****************************************************
do
cls
mx=mousex()
my=mousey()
`paste plus-minus buttons for stat adjustment----------------
`check for clicking on buttons
for z=30 to 37
sprite z,688,((z-29)*37)+189,z+20
sprite z+10,709,((z-29)*37)+189,z+30
set sprite alpha z,255
set sprite alpha z+10,255
`rollover
if current_button=z or current_button=z+10
clickon=0
if current_button>29 and current_button<38
set sprite alpha z,0
set sprite alpha 38,0
sprite 39,688,((z-29)*37)+189,59
set sprite alpha 39,255
endif
if current_button>39 and current_button<48
set sprite alpha z+10,0
set sprite alpha 48,0
sprite 49,709,((z-29)*37)+189,69
set sprite alpha 49,255
endif
endif
`click-down
if current_button=z and mouseclick()=1 and clickon=0 or current_button=z+10 and mouseclick()=1 and clickon=0
clickon=1
if current_button>29 and current_button<38
set sprite alpha z,0
set sprite alpha 39,0
sprite 38,688,((z-29)*37)+189,58
set sprite alpha 38,255
endif
if current_button>39 and current_button<48
set sprite alpha z+10,0
set sprite alpha 49,0
sprite 48,709,((z-29)*37)+189,68
set sprite alpha 48,255
endif
endif
next z
`Set collision sprite and check for collision----------------------
sprite 1000,mx,my,1000
set sprite alpha 1000,255
current_button=sprite collision (1000,0)
text 1,1,"mx="+str$(mx)
text 1,12,"my="+str$(my)
text 195,1,"button="+str$(current_button)
text 195,12,"mouse click="+str$(mouseclick())
sync
loop
Below is a look at how I am using these in the character creation program I am working on. It's nearing completion now, so I can get back to work on the 3D part
I hope this is useful to someone out there. Let me know if you can think of a better way to do these rollovers. Flash had me spoiled with buttons, but this is far more fun and creative!!!
D