hey, the second if is meant to prevent the character casting his spell while the mouse is out of the map, as this crashes the game. unfortunately, this approach does not prevent that. what am i doing wrong?
public void shadowball(){ if(Greenfoot.isKeyDown("Space")){ MouseInfo mouse = Greenfoot.getMouseInfo(); if(mouse.getX() > 0 && mouse.getX() < 600 && mouse.getY() > 0 && mouse.getY() < 600){ Actor shadowball = new Shadowball(); getWorld().addObject(shadowball, getX(), getY()); shadowball.turnTowards(mouse.getX(), mouse.getY()); } } }