Hi there, so I'm on the final stage of my Little Crab game! But I was just wondering how I give an actor (in this case the Crab) lives. So for example if the Lobster ate the Crab, the Crab would simply "respawn" (relocate) in a different position and each time this occurred it would cause the Crab to lose a life. I would like the Crab to have a total of 5 lives.
I've created a new actor named LifeCounter and here is the code so far:
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class LifeCounter here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class LifeCounter extends Actor
{
/**
* Act - do whatever the LifeCounter wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
private int crabLives ;
}
