Android Open Source - catchanimals Animal






From Project

Back to project page catchanimals.

License

The source code is released under:

GNU General Public License

If you think the Android project catchanimals 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.ricardorb.sprites;
//from www.ja  v  a 2 s .  co  m
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.MathUtils;
import com.ricardorb.catchanimals.CatchAnimals;

/**
 * Every drop in the game that the user should catch
 * 
 * @author RicardoRB
 *
 */
public class Animal extends Element {
  
  private static final int DROPVELX = 300;
  private boolean bug;
  
  public Animal(CatchAnimals game, TextureRegion textureRegion, boolean bug){
    super(textureRegion, game);
    setX(MathUtils.random(0, game.WINDOWX - getWidth()));
    setY(game.WINDOWY);
    this.bug = bug;
  }

  public void update(){
    setY(getY() - DROPVELX * Gdx.graphics.getDeltaTime());
    rectangle.x = getX();
    rectangle.y = getY();
  }

  public static int getDropvelx() {
    return DROPVELX;
  }

  public boolean isBug() {
    return bug;
  }

}




Java Source Code List

com.ricardorb.catchanimals.Assets.java
com.ricardorb.catchanimals.CatchAnimals.java
com.ricardorb.catchanimals.android.AndroidLauncher.java
com.ricardorb.catchanimals.desktop.DesktopLauncher.java
com.ricardorb.controllers.ControllerBasket.java
com.ricardorb.controllers.ControllerOption.java
com.ricardorb.inputs.InputBasket.java
com.ricardorb.screens.GameScreen.java
com.ricardorb.screens.MainMenuScreen.java
com.ricardorb.screens.OptionScreen.java
com.ricardorb.sprites.Animal.java
com.ricardorb.sprites.Basket.java
com.ricardorb.sprites.Element.java