Back to project page catchanimals.
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.
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; } }