Posted: Sat May 17, 2003 11:49 am Post subject: mouseover
hey all my.. mouseover only works for the first button... why is this? here is the code...
code:
%menu.t
var font1, font2, font3, font4, line : int
font1 := Font.New ("courier:10")
font2 := Font.New ("courier:10:bold")
%function mouseover
var mousex, mousey, mouseb,mousex1, mousey1, mouseb1,mousex2, mousey2, mouseb2,mousex3, mousey3, mouseb3 : int
function mouseover (x, y, x1, y1, x2, y2 : int) : boolean
if x >= x1 and x <= x2 then
if y >= y1 and y <= y2 then
result true
end if
end if
result false
end mouseover
% Back part of screen
drawfillbox (0, 0, 640, 400, 23)
% Part Underneath
drawfillbox (20, 110, 640, 150, 22)
drawbox (20, 110, 640, 150, 21)
var text : string
text := "SHOOTOUT"
var fontID : array 1 .. 32 of int
for i : 32 div 2 .. 32
fontID (i) := Font.New ("courier:" + intstr (i))
end for
procedure Text3D (text : string)
for t : 1 .. length (text)
for i : 32 div 2 .. 32
Font.Draw (text (t), t * 75, 120, fontID (i), 20 + floor (i / 32 * 10))
end for
also is there ne code to get rid of the detection lines?? (the little lines moving up and downt he buttons)
Sponsor Sponsor
nate
Posted: Sat May 17, 2003 3:23 pm Post subject: View.Update
1 thing which would spare anyone who is playing that games eyes would be to use (these are the so called detection lines! (but they actually aren't))
View.Set ("offscreenonly") put this right before you loop
then put right before the end loop
View.Update
as for not workin for any of the other boxes i am 2 lazy to figure it out
-Nate
Homer_simpson
Posted: Sat May 17, 2003 4:30 pm Post subject: (No subject)
the mouse over function needed alittle upgrade...
code:
%menu.t
var font1, font2, font3, font4, line : int
font1 := Font.New ("courier:10")
font2 := Font.New ("courier:10:bold")
%function mouseover
var mousex, mousey, mouseb, mousex1, mousey1, mouseb1, mousex2, mousey2, mouseb2, mousex3, mousey3, mouseb3 : int
function mouseover (x1, y1, x2, y2 : int) : boolean
var x, y, b : int
mousewhere (x, y, b)
if (x >= x1 and x <= x2) or (x >= x2 and x <= x1) then
if (y >= y1 and y <= y2) or (y >= y2 and y <= y1) then
result true
end if
end if
result false
end mouseover
% Back part of screen
drawfillbox (0, 0, 640, 400, 23)
% Part Underneath
drawfillbox (20, 110, 640, 150, 22)
drawbox (20, 110, 640, 150, 21)
var text : string
text := "SHOOTOUT"
var fontID : array 1 .. 32 of int
for i : 32 div 2 .. 32
fontID (i) := Font.New ("courier:" + intstr (i))
end for
procedure Text3D (text : string)
for t : 1 .. length (text)
for i : 32 div 2 .. 32
Font.Draw (text (t), t * 75, 120, fontID (i), 20 + floor (i / 32 * 10))
end for
Posted: Sat May 17, 2003 4:32 pm Post subject: (No subject)
add this to the beggining of the program
code:
View.Set("offscreenonly")
and add this before end loop
code:
View.Update
delay(5)
beedub
Posted: Sat May 17, 2003 6:46 pm Post subject: (No subject)
ty now it looks perfect..
beedub
Posted: Sat May 17, 2003 7:36 pm Post subject: (No subject)
one other thing... if i wanted to make them as buttons what would i do... whatdotcolor... mouse.where??I only ask this cuz when it changes color i dont really know what to do..
Tony
Posted: Sat May 17, 2003 7:59 pm Post subject: (No subject)
you shouldn't use what dot color, because that way you'd have to make all your objects different color
Posted: Sat May 17, 2003 9:40 pm Post subject: (No subject)
thats my porblem...since i am so young i havent been able to learn difficult math..the only way i can do it is with code.. or get some1 to help me with it... that is why i am here
Sponsor Sponsor
beedub
Posted: Sun May 18, 2003 3:27 pm Post subject: (No subject)
ne ideas?
Tony
Posted: Sun May 18, 2003 4:49 pm Post subject: (No subject)
i though you already got that mouseover procedure done?
Posted: Sun May 18, 2003 7:39 pm Post subject: (No subject)
can i suggest summin to u...USE GIU'S...ur menu isn't bad, but its kinda bad coz of the loop constantly refreshing itself...i'll c if i can make it betta...i'll post the finsished thingy soon...but yea...consider using a GUI..much easire...just create buttons and assigne procedures to them...
Tony
Posted: Sun May 18, 2003 10:39 pm Post subject: (No subject)
but so does GUI.. run in a loop I mean...
its not VB's on event programming, its still linear loop.
you know that loop GUI.ProcessEvent end loop thingy?
well basically its a shorter way of sticking everything in a loop. Ofcourse once you start processing your GUI, you cant do much more...
Posted: Sun May 18, 2003 11:00 pm Post subject: (No subject)
ya i know it... since this is my first actual good game.. i consider this like my tutorial game.. filled with flashing stuff...
void
Posted: Mon May 19, 2003 12:07 pm Post subject: (No subject)
too lazy to actualy make a good one for u..well..if u dun wanna have a GUI event...then do this..have a "switch" variable for each button...and if the button has the mouse over it, then the "switch" is tripped and the color changes, but when the mouse moves from the vicinity then the switch is off and the button is redraw..1 time...this will stop the refresh thingy u'v got going.....tony...i dunno..GUI's look much better coz it doesnt "refresh" as often....but wateva...ur the boss...
beedub
Posted: Mon May 19, 2003 2:55 pm Post subject: (No subject)
can u have mouseover GUIs?... and void what school you go to?