how to use the getWorld variable?
When I use it says (cannot find symbol - variable getWorld)
getWorld().addObject(new Bullet(), getX(), getY()); //add an instance of class Bullet at the current location of the actor
public class dolphin extends Actor { private final int gravity = 1; private int velocity; public dolphin() { velocity = 0; } public void act() { fall(); if(Greenfoot.isKeyDown("space") && getY() > getWorld.getHeight - 50)jump(); move(); } public void fall() { setLocation(getX(),getY() + velocity); if (getY() > getWorld.getHeight - 50)velocity = 0; else velocity += gravity; } public void jump() { velocity = -20; } public void move() { int y= getY(); int x= getX(); if(Greenfoot.isKeyDown("left"))x--; if(Greenfoot.isKeyDown("right"))x++; setLocation(x,y); } }
getWorld.getHeight
getWorld().getHeight()