Body.java


Dosyayı İndir
package com.godoro.game.eater.image;

import com.godoro.game.eater.Drawable;

abstract public class Body implements Drawable {

  protected int x;
  protected int y;
  protected int width;
  protected int height;

  public Body(int x, int y, int width, int height) {
    this.x = x;
    this.y = y;
    this.width = width;
    this.height = height;
  }

  public int getX() {
    return x;
  }

  public void setX(int x) {
    this.x = x;
  }

  public int getY() {
    return y;
  }

  public void setY(int y) {
    this.y = y;
  }

  public int getWidth() {
    return width;
  }

  public void setWidth(int width) {
    this.width = width;
  }

  public int getHeight() {
    return height;
  }

  public void setHeight(int height) {
    this.height = height;
  }

  public int getStartX() {
    return x - width / 2;
  }

  public int getStartY() {
    return y - height / 2;
  }

  public boolean collides(Body another) {
    return Math.abs(getX() - another.getX()) < 25
            && Math.abs(getY() - another.getY()) < 25;
  }

}

				
Dosyayı İndir

Bu Sayfayı Paylaş:




Bu Sayfayı Paylaş:

İletişim Bilgileri

Takip Et

Her Hakkı Saklıdır. Bu sitede yayınlanan tüm bilgi ve fikirlerin kullanımından fibiler.com sorumlu değildir. Bu sitede üretilmiş , derlenmiş içerikleri, fibiler.com'u kaynak göstermek koşuluyla kendi sitenizde kullanılabilirsiniz. Ancak telif hakkı olan içeriklerin hakları sahiplerine aittir