Skip to content

Instantly share code, notes, and snippets.

@AnnaBoro
Last active October 27, 2015 23:11
Show Gist options
  • Save AnnaBoro/1e02cfbc22b0f0b1ef94 to your computer and use it in GitHub Desktop.
Save AnnaBoro/1e02cfbc22b0f0b1ef94 to your computer and use it in GitHub Desktop.
lesson4-Tank1-Frame10
package lesson4;
/**
* Created by anna on 27.10.15.
*/
public class Tank1 {
private int direction = 1;
private int x = 128;
private int y = 512;
private int speed = 10;
private ActionField actionField;
private BattleField battleField;
public Tank1(ActionField actionField, BattleField battleField) {
this.actionField = actionField;
this.battleField = battleField;
}
public void turn(int direction) {
this.direction = direction;
actionField.processTurn(this);
}
public void move() throws InterruptedException {
actionField.processMove(this);
}
public void fire() throws InterruptedException {
Bullet bullet = new Bullet(x + 25, y + 25, direction);
actionField.processFire(bullet);
}
public void moveRandom() {
}
public void moveToQuadrant(int v, int h) {
}
public int getDirection() {
return direction;
}
public void setDirection(int direction) {
this.direction = direction;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public void setX(int x) {
this.x = x;
}
public void setY(int y) {
this.y = y;
}
public int getSpeed() {
return speed;
}
public void setSpeed(int speed) {
this.speed = speed;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment