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

2019/6/28

Object mowing by mouse doesnt work...

Proprogrammer04 Proprogrammer04

2019/6/28

#
In my Scenario, I Need to drag objects, while the game runs… Itried this:
if(Greenfoot.mouseDragged(this))
            {
                try
                {
                    setLocation(m.getX(),m.getX());
                }catch(Exception e){ }
            }
...but it does not work. When I try to drag the mouse, it teleports anywhere, but not at the mouse's Position (!)
Super_Hippo Super_Hippo

2019/6/29

#
Where/When do you get the MouseInfo object?
danpost danpost

2019/6/29

#
It probably teleports to the location the mouse was at when the object was created. The field (m) does not update on its own.
Proprogrammer04 Proprogrammer04

2019/7/3

#
danpost wrote...
It probably teleports to the location the mouse was at when the object was created. The field (m) does not update on its own.
That worked, when I update the Information in act, it works, thank you
You need to login to post a reply.