Android Open Source - KillMarmotGame Marmot






From Project

Back to project page KillMarmotGame.

License

The source code is released under:

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUC...

If you think the Android project KillMarmotGame 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 ru.levrun.libgdx_demo;
/* w  w w. j a  v  a  2  s. c  o m*/
import java.util.Random;

import com.badlogic.gdx.math.Rectangle;

public class Marmot {
  
  public static Random randomGenerator = new Random();
  
  private Rectangle cell;
  private int x;
  private int y;
  
  public Marmot(int x, int y) {
    this.x = x;
    this.y = y;
    cell = new Rectangle();
    cell.width = Game.CELL_WEIGHT;
    cell.height = Game.CELL_HEIGHT;
    cell.x = cell.width + x * Game.CELL_WEIGHT - 80;
    cell.y = cell.height + y * Game.CELL_HEIGHT + 100;
  }
  
  public Rectangle getRectangle() {
    return this.cell;
  }
  
  public int getX() {
    return x;
  }
  
  public int getY() {
    return y;
  }
  
  public static Marmot getRandomMarmotCell(Marmot[][] field) {
    int i = randomGenerator.nextInt(Game.FIELD_COLS);
    int j = randomGenerator.nextInt(Game.FIELD_ROWS);
    
    return field[i][j];
  }
  
  
  

}




Java Source Code List

ru.levrun.libgdx_demo.GameUtils.java
ru.levrun.libgdx_demo.Game.java
ru.levrun.libgdx_demo.MainActivity.java
ru.levrun.libgdx_demo.Marmot.java
ru.levrun.libgdx_demo.MyTimer.java