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

2016/11/21

getX getY after dragging an object

I am so frustrated as I just dunno how to getX getY after dragging an object which is already initialised in the World. I have to getX() and get Y() for writing a new method in the editor of the actor, but when I write the codes in the following way, errors just come out. Editor of the World: public void initialize() { DummyGuy aDummyGuy=new DummyGuy(); GWorld.addOneObject(aDummyGuy,5,9); } Editor of DummyGuy: import.Greenfoot,*; public void taskOne(){ int x=adummyGuy.getX(); int y=adummyGuy.getY(); ........ } The code just doesn't work><
danpost danpost

2016/11/21

#
It might be best if you show the entire class codes. Also, use code tags (see the link 'Posting code? read this!' below the 'Post a reply' content box).
You need to login to post a reply.