I need to make my class (bluePearl) so you can walk through it. Since you need to comsume it.
Maybe making so you can just eat it from the cell beside it is easier?
I defintly need to know.
public class Player extends Actor
{
boolean aboutFace;
int ySpeed = 0, xSpeed = 0;
final int jSpeed = 20;
private void move()
{
ySpeed++; // adds gravity
if (xSpeed != 0 && onGround) xSpeed +=aboutFace?2:-2; // add friction
setLocation(getX()+xSpeed/10, getY()+ySpeed/2);
// check for change in horizontal direction
if((xSpeed>0 && aboutFace) || (xSpeed<0 && !aboutFace))
{
getImage().mirrorHorizontally();
aboutFace = !aboutFace;
}
// check for obstacles
onGround=false; // initialize value
// check below the actor
while(getOneObjectAtOffset(0, getImage().getHeight()/2+1, null)!=null)
{
setLocation(getX(), getY()-1);
onGround=true;
ySpeed=0;
}
// check above the actor
while(getOneObjectAtOffset(0, -getImage().getHeight()/2-1, null)!=null)
{
setLocation(getX(), getY()+1);
ySpeed = 0;
}
// check to right of actor
while(getOneObjectAtOffset(getImage().getWidth()/2+1, 0, null)!=null)
{
setLocation(getX()-1, getY());
xSpeed = 0;
}
// check to left of actor
while(getOneObjectAtOffset(-getImage().getWidth()/2-1, 0, null)!=null)
{
setLocation(getX()+1, getY());
xSpeed = 0;
}

