This site requires JavaScript, please enable it in your browser!
Greenfoot back
Gazzzah
Gazzzah wrote ...

2012/2/10

Constant update of mouse info

1
2
danpost danpost

2012/2/11

#
Did you check to make sure 'released' was set to true?
danpost danpost

2012/2/11

#
Try:
MouseInfo mi = Greenfoot.getMouseInfo();
int btn = mi.getButton();
if (btn== 1)
{
    System.out.println("Left mouse clicked");
    if (released)
    {
        System.out.println("released is true")
        leftClicked = true;
        released = false;
    }
}
if (btn == 3)
{
    rightClicked = true;
}
and see what results you get; and post back with results.
Gazzzah Gazzzah

2012/2/12

#
Ok yeah I think released was the problem, I quoted it out and it fixed. But it's still acting when I release the mouse button :S I want to be able to hold it down.
danpost danpost

2012/2/12

#
try mousePressed instead of mouseClicked. or mousePressed and !mouseClicked.
Gazzzah Gazzzah

2012/2/13

#
Ok! I played around a bit with using mousePressed and !mouseClicked. I have found a way that works perfectly :D Thank you very much for your help!
You need to login to post a reply.
1
2