thx for your help
if(getY() > getWorld().getHeight()-100 && getY() < getWorld().getHeight()-50)
if(getY() > getWorld().getHeight()-100 && getY() < getWorld().getHeight()-50 && string.equals(getChar()))
java.lang.NullPointerException at Block.checkKey(Block.java:35) at GameWorld.act(GameWorld.java:44) at greenfoot.core.Simulation.actWorld(Simulation.java:571)
public void act() { String str = Greenfoot.getKey(); if (str != null) { System.out.println(str); for (Object obj : getObjects(Block.class)) { ((Block) obj).checkKey(str); } } }
String str = Greenfoot.getKey(); if (str != null) { if(System.currentTimeMillis()-lastTime < 35) { System.out.println("close"); if(lastString.equalsIgnoreCase(str)) { System.out.println("too close"); return; } } lastString = str; lastTime = System.currentTimeMillis(); for (Object obj : getObjects(Block.class)) { ((Block) obj).checkKey(str); } }