
-----------------------------------
beedub
Mon May 12, 2003 8:34 pm

Mouse Question
-----------------------------------
kkkk... here it is... i need some help with mouse action (when i press a certain image)..... here is the image that i need help with:  drawfilloval (260, 140, 40,20,113)  when it is pressed i need to to go to a clear screen... lol this isnt a project i am working on... my school doesnt even have turing.. im 12... apparently you dont start learning it till highschool...

MOD EDIT: Title has been changed. Do not make general topics. -Asok

-----------------------------------
beedub
Mon May 12, 2003 8:36 pm


-----------------------------------
also... sorry im not actually helping ne one... i need actually learn how to "ture"to be cable to help people... lol.. but when ever i make some n00bish games ill be sure to post it..  :oops:

-----------------------------------
Dan
Mon May 12, 2003 8:58 pm


-----------------------------------
i am asuming you know the mouse codes...


basickly you do closion dection but with the mouse's quartents and the loaction of the image.

tutorial on colsion dection: http://www.compsci.ca/bbs/viewtopic.php?t=75

rember to look down for info on dection for difrent shaps and i think there is info on mouse closion dection.

also for mouse codes go here: http://www.compsci.ca/bbs/viewtopic.php?t=6

-----------------------------------
beedub
Mon May 12, 2003 9:19 pm


-----------------------------------
i know this is kinda sad.. but.. i am so confused... :(... looks like im not cut out for this sheit

-----------------------------------
void
Mon May 12, 2003 9:19 pm


-----------------------------------
jeeze dan...he clearly stated he was n00b...that means NEWbe....the NEW meaning he NEW to the language...ya...im just kidding man...i was bored as hell...and i came across this..
SUGGESTION:
if your just doing a program that has nothing in the background but this button...like...if the color of the button is not like the color of anything else that you have on the screen on the moment...then use whatdotcolor..of the location...since your a n00b...im gonna post the syntax...dont just copy and be satisfied...im doing this coz personaly i learned best from examples when i started programming...so im assuming you might be like me...if you can learn how to use the code without copying...then ur better off because you can manipulate it in other programs u make...(as you can see...im am very against the copying of codes..but posting them helps you learn)

var x, y, button : int
%%X is the x co-ordinate of the mouse, y being the y co-ordinate, and button is a variable telling you if the button is clicked or not
drawfilloval (260, 140, 40, 20, 113)
%%draw the circle...blah blah
loop
    Mouse.Where (x, y, button)
    %%calls the mouse where which finds out WHERE THE MOUSE IS.....(its done in a loop because the mouse is constantly moving
    if whatdotcolor (x, y) = 114 and button = 1 then 
        %%if the color under the pointer is equal to that of the circle and the button is clicked then
        cls %%clear the screen
        exit%%exit the loop
    end if%%end the if statement
end loop%%end the loop
%%sorry for the over comenting....


-----------------------------------
beedub
Mon May 12, 2003 9:20 pm


-----------------------------------
TY>>>

-----------------------------------
Tony
Mon May 12, 2003 9:22 pm


-----------------------------------
yeah... dan often scares people with his replies... but he does pay the bills and edits some PHP so I think we should let him stay an admin for a little while longer  :wink:

-----------------------------------
beedub
Mon May 12, 2003 9:25 pm


-----------------------------------
i agree.. lol just trying to get bits... even tho i dont really know what they do... cept they give you a glow on ur name... hopefully ill get that soon...anyways srry...and ty dan for being a good admin... and payer of bills ;)

-----------------------------------
beedub
Mon May 12, 2003 9:28 pm


-----------------------------------
omg... i am so srry... for taking up this whole post.. but.. i need some help with the collision detection part of it... if i want the circle (posted earlier).. to be pressed any where on it.. how would i fit that into the code that void posted earlier...

-----------------------------------
Tony
Mon May 12, 2003 9:32 pm


-----------------------------------
well void's code checks for the color of the circle, so technically you can click a same colored square anywhere else on the screen for it to work :?

So your circle can be places anywhere on the screen. (Gotta be unique color though).

If you want a mathimatical aproach, you chould check out circle collision detection ( in tutorials). You basically just see how far away you clicked from the center of the circle.

-----------------------------------
beedub
Mon May 12, 2003 9:38 pm


-----------------------------------
thats what i have been trying to do... but i just cant seem to be able to... make it go to a differetn screen when it is pressed

-----------------------------------
Tony
Mon May 12, 2003 9:40 pm


-----------------------------------
thats cuz void's code is wrong. Buttom color is 113 but he's checking for 114 :?

In the if statment, the color must be the same as of your button

-----------------------------------
beedub
Mon May 12, 2003 9:41 pm


-----------------------------------
omg thats it... i am such a stupid kid... there we go

-----------------------------------
beedub
Mon May 12, 2003 9:49 pm


-----------------------------------
it works perfectly now....

-----------------------------------
Homer_simpson
Mon May 12, 2003 9:57 pm


-----------------------------------
these 2 functions may help you...
function rectanglemouseover (x1, y1, x2, y2 : int) : boolean
    var mousex, mousey, mouseb : int
    mousewhere (mousex, mousey, mouseb)
    if mousex >= x1 and mousex = y1 and mousey 