hey im making a Space Invaders look a like. But the problem is that when i killed an enemy the score need to go up but Greenfoot can't find MyWorld.?! i think it is beacause it is not a real Greenfoot statement but i see codes all the time using MyWorld. If you know wye its not working please help me out
{ /** * Act - do whatever the Bullit wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { setLocation(getX(), getY() -10); if(getY() <= 20) { World SpaceWorld; SpaceWorld = getWorld(); SpaceWorld.removeObject(this); } if ( getWorld() != null) { Enemy theEnemy; theEnemy = (Enemy) getOneIntersectingObject(Enemy.class); if (theEnemy != null) { World world; world = getWorld(); //world.removeObject(theEnemy); theEnemy.hitpoints--; world.removeObject(this); Counter score= myWorld.getScore(); score.add(1); } } } }