public void act() { // check moving int playerX = 0, playerY = 0; if (Greenfoot.isKeyDown("D")) playerX++; if (Greenfoot.isKeyDown("A")) playerX--; if (Greenfoot.isKeyDown("S") && playerY() < 14 && world[playerX][playerY + 1]) playerY++; // the line of code that i changed if (Greenfoot.isKeyDown("W")) playerY--; // do no more if trying to move past edge int x = player.getX(), y = player.getY(); if (x+playerX < 0 || x+playerX > WIDE-1) return; if (y+playerY < 0 || y+playerY > HIGH-1) return; // move player player.setLocation(player.getX()+playerX, player.getY()+playerY); // scroll, if able if (!(playerX == -1 && scrollX == 0) && !(playerY == -1 && scrollY == 0) && !(playerX == 1 && scrollX == BIG_X-WIDE) && !(playerY == 1 && scrollY == BIG_Y-HIGH)) scroll(playerX, playerY); // time delay when moving Greenfoot.delay(10); }