i would like a health boolean for my soul (i am making an undertale fight) so heres the code so far
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import greenfoot.collision.CollisionChecker;
/**
* Write a description of class Soul here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Soul extends Actor
{
/**
* Act - do whatever the Soul wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
checkKeyPress();
if ( touchingObjectBlast() )
{
//i want it to remove health
}
}
public boolean touchingObjectBlast()
{
return (getOneIntersectingObject(Blast.class) != null);
}
public void checkKeyPress()
{
if (Greenfoot.isKeyDown("up"))
{
setLocation(getX(), getY()-2);
}
if (Greenfoot.isKeyDown("down"))
{
setLocation(getX(), getY()+2);
}
if (Greenfoot.isKeyDown("left"))
{
setLocation(getX()-2, getY());
}
if (Greenfoot.isKeyDown("right"))
{
setLocation(getX()+2, getY());
}
}
}


