// Places a random bait into the arena public Bait giveBait() { if (baits.size() == 0) // if there are no baits then create some createBaits(); board[baits.get(0).retrievePiece().getX()][baits.get(0).retrievePiece().getY()] = baits.get(0).retrievePiece(); Bait tmp = baits.get(0); System.out.println("Bait" + tmp.retrievePiece().getType()); baits.remove(0); return tmp; }
// updates the view of the arena public void update(Graphics g) { // moving the snake createScreen(g); moveSnake(); System.out.println(status); if (status == 1) // eat { snake.eatBait(current); current.affect(); current = giveBait(); } status = snake.getStatus(); // this is because if the bait was poisonous or not if (status == -1) // die { endGame(); } status = 0; }