I don't understand sorry, do you mean how big it is?
public class OpenableDoor extends Actor
public class Characters extends Actor
{
/**
* Act - do whatever the Characters wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
OpenableDoor door = (OpenableDoor)getOneIntersectingObject(OpenableDoor.class);
if (door != null && !door.isOpen()) stopByOpenableDoor(door);
}
public void stopByOpenableDoor(Actor closeDoor)
{
int wallWidth = closeDoor.getImage().getWidth();
int newX = closeDoor.getX() -(wallWidth + getImage().getWidth()) -10;
setLocation(newX , getY());
}
}
public class Betty extends Characters
{
private GreenfootImage Betty1= new GreenfootImage("Betty1.png");
private GreenfootImage Betty2= new GreenfootImage("Betty2.png");
private GreenfootImage BettyGun1= new GreenfootImage("Betty_Gun_1.png");
private GreenfootImage BettyGun2= new GreenfootImage("Betty_Gun_2.png");
private int animatecounter;
private int pistolGrabbed;
public int fireTimer = 0;
private boolean fire = false;
public int lives = 5;
/**
* Act - do whatever the Betty wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
grabPistol();
BettyMovement();
super.act();
checkRightWalls();
checkLeftWalls();
platformAbove();
platformBelow();
if (fireTimer != 0)
{
fireTimer --;
}
else
{
fire = false;
}
if (Greenfoot.isKeyDown("e"))
{
OpenableDoor door = (OpenableDoor) getOneIntersectingObject(OpenableDoor.class);
}
}
public void healthBar()
{
lives--;
}
public void detectBulletCollision()
{
if (isTouching(Bullet.class))
{
healthBar();
}
}
public void grabPistol()
{
if (isTouching(Pistol.class) && Greenfoot.isKeyDown("E"))
{
removeTouching(Pistol.class);
pistolGrabbed++;
}
}
private void BettyMovement()
{
if (Greenfoot.isKeyDown("d")) {
setLocation(getX()+1,getY());
animate();
animateWithGun();
}
if (Greenfoot.isKeyDown("a")) {
setLocation(getX()-1,getY());
animate();
animateWithGun();
}
if (Greenfoot.isKeyDown("s")) {
setLocation(getX(),getY()+1);
animate();
animateWithGun();
}
if (Greenfoot.isKeyDown("w")) {
setLocation(getX(),getY()-1);
animate();
animateWithGun();
}
if (Greenfoot.mouseClicked(this))
{
shoot();
}
if (Greenfoot.isKeyDown("d") && Greenfoot.isKeyDown("shift") ) {
setLocation(getX()+2,getY());
animate();
animateWithGun();
}
if (Greenfoot.isKeyDown("w") && Greenfoot.isKeyDown("shift") )
{
setLocation(getX(),getY()-2);
animate();
animateWithGun();
}
if (Greenfoot.isKeyDown("a") && Greenfoot.isKeyDown("shift") )
{
setLocation(getX()-2,getY());
animate();
animateWithGun();
}
if (Greenfoot.isKeyDown("s") && Greenfoot.isKeyDown("shift") )
{
setLocation(getX(),getY()+2);
animate();
animateWithGun();
}
if (Greenfoot.isKeyDown("p") && isTouching(RobotEnemy.class))
{
removeTouching(RobotEnemy.class);
}
}
public void animate()
{
if (pistolGrabbed <1){
animatecounter++;
if (animatecounter > 5) {
animatecounter = 0;
if (getImage() == Betty1) {
setImage(Betty2);
}
else {
setImage(Betty1); }
}
}
}
public void animateWithGun() {
if (pistolGrabbed ==1){
animatecounter++;
if (animatecounter > 5) {
animatecounter = 0;
if (getImage() == BettyGun1) {
setImage(BettyGun2);
}
else {
setImage(BettyGun1); }
}
}
}
public void shoot() {
if (pistolGrabbed ==1 && fire == false)
{
fire();
fire = true;
fireTimer = 25;
}
}
private void fire()
{
Bullet bullet = new Bullet();
getWorld().addObject(bullet, getX(), getY());
bullet.move(06);
}
public boolean checkRightWalls()
{
int spriteWidth = getImage().getWidth();
int xDistance = (int) (spriteWidth/2);
Actor rightWall = getOneObjectAtOffset (xDistance, 0, Brick.class);
if (rightWall == null)
{
return false;
}
else
{
stopByRightWall(rightWall);
return true;
}
}
public void stopByRightWall(Actor rightWall)
{
int wallWidth = rightWall.getImage().getWidth();
int newX = rightWall.getX() -(wallWidth + getImage().getWidth())/2;
setLocation(newX , getY());
}
public boolean checkLeftWalls()
{
int spriteWidth = getImage().getWidth();
int xDistance = (int) (spriteWidth/-2);
Actor leftWall = getOneObjectAtOffset (xDistance, 0, Brick.class);
if (leftWall == null)
{
return false;
}
else
{
stopByLeftWall(leftWall);
return true;
}
}
public void stopByLeftWall(Actor leftWall)
{
int wallWidth = leftWall.getImage().getWidth();
int newX = leftWall.getX() -(wallWidth + getImage().getWidth())/-2;
setLocation(newX , getY());
}
public boolean platformAbove()
{
int spriteHeight = getImage().getHeight();
int yDistance = (int) (spriteHeight / 2 + 5);
Actor ceiling = getOneObjectAtOffset(0, getImage().getHeight()/2, (Brick.class));
if (ceiling == null)
{
return false;
}
else
{
stopByCeiling(ceiling);
return true;
}
}
public void stopByCeiling(Actor ceiling)
{
int ceilingHeight = ceiling.getImage().getHeight();
int newY = ceiling.getY() + (ceilingHeight + getImage().getWidth())/2;
setLocation(getX() , newY);
}
public boolean platformBelow()
{
int spriteHeight = getImage().getHeight();
int yDistance = (int) (spriteHeight / -2);
Actor floor = getOneObjectAtOffset(0, yDistance, (Brick.class));
if (floor == null)
{
return false;
}
else
{
stopByFloor(floor);
return true;
}
}
public void stopByFloor(Actor floor)
{
int floorHeight = floor.getImage().getHeight();
int newY = floor.getY() - (floorHeight + getImage().getWidth())/2;
setLocation(getX() , newY);
}
}
int newX = closeDoor.getX()-(wallWidth+getImage().getWidth())/2+1;