Hello,
at the first, I am from Germany and my English isnt that well..
so I have this problem and I hope u can help me to find a solution..
If the shot of my Spaceship collides with and "Asteorid" the shot should be removed. The same should happen, if the shot collides with my World Edge.
I receive always this msg in the console:
"amRandDerWelt()" is an method that our teacher created. It equals this :
java.lang.IllegalStateException: Actor not in world. An attempt was made to use the actor's location while it is not in the world. Either it has not yet been inserted, or it has been removed. at greenfoot.Actor.failIfNotInWorld(Actor.java:681) at greenfoot.Actor.getX(Actor.java:157) at Shot.amRandDerWelt(Shot.java:51) at Shot.act(Shot.java:34) at greenfoot.core.Simulation.actActor(Simulation.java:583) at greenfoot.core.Simulation.runOneLoop(Simulation.java:541) at greenfoot.core.Simulation.runContent(Simulation.java:215) at greenfoot.core.Simulation.run(Simulation.java:205)"
public boolean amRandDerWelt(){ if(getX() < 20 || getX() > getWorld().getWidth() - 20) return true; if(getY() < 20 || getY() > getWorld().getHeight()- 20) return true; else return false; }