Android Open Source - endlessJourney Speed






From Project

Back to project page endlessJourney.

License

The source code is released under:

GNU General Public License

If you think the Android project endlessJourney listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.kambashi.endlessjourney.model.components;
//  www. j  a v  a 2  s. c  o  m
public class Speed {

  public static final int DIRECTION_RIGHT = 1;
  public static final int DIRECTION_LEFT = -1;
  public static final int DIRECTION_UP = -1;
  public static final int DIRECTION_DOWN = 1;

  private float xv = 1; // velocity value on the X axis
  private float yv = 1; // velocity value on the Y axis

  private int xDirection = DIRECTION_RIGHT;
  private int yDirection = DIRECTION_DOWN;

  public Speed() {
    this.xv = 5;
    this.yv = 5;
  }

  public Speed(float xv, float yv) {
    this.xv = xv;
    this.yv = yv;
  }

  public float getXv() {
    return xv;
  }

  public void setXv(float xv) {
    this.xv = xv;
  }

  public float getYv() {
    return yv;
  }

  public void setYv(float yv) {
    this.yv = yv;
  }

  public int getxDirection() {
    return xDirection;
  }

  public void setxDirection(int xDirection) {
    this.xDirection = xDirection;
  }

  public int getyDirection() {
    return yDirection;
  }

  public void setyDirection(int yDirection) {
    this.yDirection = yDirection;
  }

  // changes the direction on the X axis
  public void toggleXDirection() {
    xDirection = xDirection * -1;
  }

  // changes the direction on the Y axis
  public void toggleYDirection() {
    yDirection = yDirection * -1;
  }
}




Java Source Code List

com.kambashi.endlessjourney.EndlessActivity.java
com.kambashi.endlessjourney.MainGamePanel.java
com.kambashi.endlessjourney.MainThread.java
com.kambashi.endlessjourney.model.Bot.java
com.kambashi.endlessjourney.model.components.Speed.java