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

2011/3/25

mouse cursor

hlm hlm

2011/3/25

#
Hi, i have sprite under cursor... in act: if(Greenfoot.mouseMoved(null)) { MouseInfo mouse = Greenfoot.getMouseInfo(); setLocation(mouse.getX(), mouse.getY()); } but if i hold mouse button.. mouse cursor move and sprite hold position, when i release mouse button my sprite jump to mouse cursor position... exist some solution? thanks
Builderboy2005 Builderboy2005

2011/3/26

#
Try this instead: MouseInfo mouse = Greenfoot.getMouseInfo(); if(mouse!=null){ setLocation(mouse.getX(),mouse.getY()); } :)
You need to login to post a reply.