Computer Science Canada

mouse trouble!!

Author:  unknowngiver [ Mon May 22, 2006 3:37 pm ]
Post subject:  mouse trouble!!

hey
I am making a game and i m having trouble making making the menu for it..i want to make use the MOUSE HOVER effect...so when someone goes over the button with there mouse..it changes to another image...well i used this code but its not working..can anyone help me out please???i cant post the whole game code...but if u add me on msn i will send it 2 u so you can help me out and all
[my msn is admin@apkafuture.com]

code:
loop
    % Mouse Position
    Mouse.Where (m_x, m_y, m_b)

    % Menu
    if m_x > 7 and m_x < 164 and m_y > 456 and m_y < 433 then
        Pic.Draw (menu_, 7, 433, picCopy)
        if m_b = 1 then

        end if
    else
        Pic.Draw (menu, 7, 433, picCopy)
    end if
end loop


now i have another question

In the game i have a background image..and for menu bar i want the buttons to have a lower opacity so the user still sees some of the background..i did that in photoshop and hten imported the image...but it doesnt recognize the background in turing and just makes it White [the back of the button..] is there a way out of this??
Thanks

Author:  rownale [ Mon May 22, 2006 3:48 pm ]
Post subject: 

1.i believe u have the <> signs mixed up

if m_x > 7 and m_x < 164 and m_y > 456 and m_y < 433 then

should maybe be

if m_x > 7 and m_x < 164 and m_y < 456 and m_y > 433 then

that might be the problem


2. Try copying the image into paint and save it as bmp?

Author:  unknowngiver [ Mon May 22, 2006 4:08 pm ]
Post subject: 

code:


if m_x > 7 and m_x < 164 and m_y < 456 and m_y > 433 then

i tried that..it dint work Sad

Author:  TheOneTrueGod [ Mon May 22, 2006 4:34 pm ]
Post subject: 

Try using the command
code:

break


Its a useful debugging tool, which will stop the code once it gets to that point. If you put it inside of that if statement, it will tell you whether or not the code is getting that far. If it does in fact reach the break statement, then you know that the "if" statement is correct, and the problem lies elsewhere (Like variable declarations/names).

Author:  unknowngiver [ Mon May 22, 2006 4:38 pm ]
Post subject: 

okay
well the programm is still running..but its much slower now..and there was a rectangle..it disapears..

Author:  TheOneTrueGod [ Mon May 22, 2006 4:58 pm ]
Post subject: 

well, if the program didn't halt, then its not getting to the break statement. Look through and figure out why (and btw, rownale was right, the > and < signs were reversed on the mouse's y co-ordinates, I hope you used his, because they were correct)

Author:  unknowngiver [ Mon May 22, 2006 5:17 pm ]
Post subject: 

oo okay
well i tried his coordinates now n the program just closes and it says...the program reached the break point....but when i remove the break point and use his coordinate..i still dont see the hover button Sad

Author:  TheOneTrueGod [ Mon May 22, 2006 7:07 pm ]
Post subject: 

lol, then obviously the problem lies within that block of code Razz The whole point of this excercise was to teach you to debug on your own. I'll tell you that, from the code you gave us, the problem lies within your menu_ variable. Did you declare it properly? Is it a different picture than "menu"? Are you sure? Better go check Very Happy . Other than that, i'd need more code to be able to tell you what is wrong.

Author:  unknowngiver [ Mon May 22, 2006 10:57 pm ]
Post subject: 

nopes
i tried everything..still not working
i cant upload the whole code here..can you please add me on msn
admin@apkafuture.com
thanks Smile

Author:  TheOneTrueGod [ Tue May 23, 2006 7:12 am ]
Post subject: 

You know you can attach .t files, right? Theres an "add attachment" button right above the "submit" button. Very Happy (I'm kinda hesitant to add people to my MSN currently)

Author:  Remm [ Tue May 23, 2006 9:17 am ]
Post subject: 

So the colour changes when you highlight the menu option, just put code that when you are highlighting the option, you re-draw the menu option in a different colour, then when its not highlighted, it redraws in whatever its origonal colour is. If your having problems finding a point around the menu option, take the points you are using for the mouse and put them into a draw.box command and see if it acually goes around the menu option or not.

also, if 'offscreenonly' is on, the menu using the mouse will NOT work. Dont ask me why, it just doesnt.

Author:  unknowngiver [ Tue May 23, 2006 9:53 am ]
Post subject: 

yea the problem was offscreenonly thing..but when i remove that my scrolling text doesnt work Sad

Author:  Remm [ Tue May 23, 2006 10:42 am ]
Post subject: 

'ack' well, cant you take off offscreen only, then put it back on when you put in your scrolling text, and take it off when its done
nooffscreenonly
and
offscreenonly
if that doesnt work, you might have to get rid of somthing... unless anyone else knows of a better way? Good luck.


: