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


mouse cursor

hlm hlm


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


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