This is my updated code. Unfortunately, I have the same problem. When the two objects intersect only once, the game will stop, as opposed to five times.
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) public class Player extends MazeCreature { private int foodEaten = 0; private int lives = 5; public Player(int size) { getImage().scale(size,size); int angle = Greenfoot.getRandomNumber(4)*90; setRotation(angle); } public Player() { this(40); } public void act() { checkKeys(); if(canMove()) { moveForward(); Actor lizard = getOneIntersectingObject(Lizard.class); if (lizard!=null) { lives=lives-1; if (lives==0) { Greenfoot.stop(); } } } Actor food = getOneIntersectingObject(Food.class); if(food!=null) { getWorld().removeObject(food); foodEaten++; } } public void checkKeys() { if(Greenfoot.isKeyDown("right")) { setRotation(EAST); } if(Greenfoot.isKeyDown("down")){ setRotation(SOUTH); } if(Greenfoot.isKeyDown("left")) { setRotation(WEST); } if(Greenfoot.isKeyDown("up")) { setRotation(NORTH); } } }