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

2017/7/15

Any Help with Greenfoot.mouse dragged

Venbha Venbha

2017/7/15

#
What is that? can any one help me with it? Type a Sample Code Please

So I can Understand it!

Super_Hippo Super_Hippo

2017/7/15

#
You can check if you press and move the mouse. The mousePressed method will only return true once when the mouse changes from not-pressed to pressed. mouseDragged will return true until the mouse is not pressed anymore.
Venbha Venbha

2017/7/16

#
Ok.. Need A Sample

CODE

Super_Hippo Super_Hippo

2017/7/16

#
public void act()
{
    if (Greenfoot.mouseDragged(this))
    {
        MouseInfo mouse = Greenfoot.getMouseInfo();
        setLocation(mouse.getX(), mouse.getY());
    }
}
danpost danpost

2017/7/16

#
Super_Hippo wrote...
mouseDragged will return true until the mouse is not pressed anymore.
mouseDragged only returns true when the mouse is moved with a mouse button in the down position. It does not return true if movement has stopped while a button is down.
Venbha Venbha

2017/7/22

#
Thank you it worked!!
Venbha Venbha

2017/7/22

#
See This link to see it worked; ------> My scenario is here!
You need to login to post a reply.