Dear,
In my world I placed a couple of portals with a 'ourWorld' field. How can I get the ourWorld-value? I place a getter and setter in the portal class.
I want to know on which portal I am standing.
Yours,
Dennis
public Portal(int ourworld){ this.ourworld = ourworld; } public void setOurWorld(int ourworld){ this.ourworld = ourworld; } public int getOurWorld(){ return ourworld; }
public void checkForPortal(){ Actor portal = getOneObjectAtOffset(10, 10, Portal.class); System.out.println( /* portat.getOuwWorld() */); // Te lang op de portal geeft andere effecten // opvangen met getKey (indien mogelijk) if(portal != null && Greenfoot.isKeyDown("up")){ if(getWorld() instanceof TrainingGround){ Greenfoot.setWorld(new Questmap()); } if(getWorld() instanceof Questmap){ Greenfoot.setWorld(new TrainingGround()); } } }