Android Open Source - CatchDROP Falling Rect






From Project

Back to project page CatchDROP.

License

The source code is released under:

GNU General Public License

If you think the Android project CatchDROP 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 projects.nerdybuzz.catchdrop;
//from  w w w .  j  av a 2 s . com
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.math.Rectangle;

public class FallingRect extends Rectangle implements FallingAct {
  private static final long serialVersionUID = 1L;
  
  final CDGame game;
  
  public boolean loseOnMiss = false;
  public int gainValue = 0;
  public int loseValue = 0;
  
  public Texture rectImg;
  
  public FallingRect(final CDGame game) {
    this.game = game;
  }
  
  public FallingRect(final CDGame game, float x, float y, float width, float height) {
    super(x,y,width,height);
    this.game = game;
  }
  
  public FallingRect(final CDGame game, float x, float y, float width, float height, boolean loseOnMiss, int gainValue, int loseValue) {
    super(x,y,width,height);
    this.game = game;
    this.loseOnMiss = loseOnMiss;
    this.gainValue = gainValue;
    this.loseValue = loseValue;
  }
  
  public FallingRect(final CDGame game, float x, float y, float width, float height, boolean loseOnMiss, int gainValue, int loseValue, Texture rectImg) {
    super(x,y,width,height);
    this.game = game;
    this.loseOnMiss = loseOnMiss;
    this.gainValue = gainValue;
    this.loseValue = loseValue;
    setImg(rectImg);
  }
  
  public FallingRect(final CDGame game, boolean loseOnMiss, int gainValue, int loseValue) {
    this.game = game;
    this.loseOnMiss = loseOnMiss;
    this.gainValue = gainValue;
    this.loseValue = loseValue;
  }
  
  public void set(boolean loseOnMiss, int gainValue, int loseValue) {
    this.loseOnMiss = loseOnMiss;
    this.gainValue = gainValue;
    this.loseValue = loseValue;
  }
  
  public void set(boolean loseOnMiss, int gainValue, int loseValue, Texture rectImg) {
    this.loseOnMiss = loseOnMiss;
    this.gainValue = gainValue;
    this.loseValue = loseValue;
    setImg(rectImg);
  }
  
  public void setImg(Texture rectImg) {
    this.rectImg = rectImg;
  }
  
  public void setImg(String rectImg) {
    this.rectImg = new Texture(rectImg);
  }
  
  public Texture getImg() {
    return rectImg;
  }
  
  public FallingAct action;

  @Override
  public void onMiss() {
    game.missedDrops++;
  }

  @Override
  public void onGet() {
    game.score -= loseValue;
    game.score += gainValue;
  }

  @Override
  public void onSpawn() {
    
  }

  @Override
  public void onDispose() {
    this.dispose();
  }

  public void dispose() {
    rectImg.dispose();
  }
}




Java Source Code List

android.UnusedStub.java
com.google.example.games.basegameutils.BaseGameActivity.java
com.google.example.games.basegameutils.BaseGameUtils.java
com.google.example.games.basegameutils.GameHelperUtils.java
com.google.example.games.basegameutils.GameHelper.java
projects.nerdybuzz.catchdrop.BurntToastObj.java
projects.nerdybuzz.catchdrop.CDGame.java
projects.nerdybuzz.catchdrop.ClassicGame.java
projects.nerdybuzz.catchdrop.EndScreen.java
projects.nerdybuzz.catchdrop.FallingAct.java
projects.nerdybuzz.catchdrop.FallingRect.java
projects.nerdybuzz.catchdrop.GameScreen.java
projects.nerdybuzz.catchdrop.KeySequence.java
projects.nerdybuzz.catchdrop.MainMenuScreen.java
projects.nerdybuzz.catchdrop.PoisonDrop.java
projects.nerdybuzz.catchdrop.SettingsScreen.java
projects.nerdybuzz.catchdrop.TimePowerUp.java
projects.nerdybuzz.catchdrop.ZenGame.java
projects.nerdybuzz.catchdrop.android.AndroidLauncher.java
projects.nerdybuzz.catchdrop.client.HtmlLauncher.java
projects.nerdybuzz.catchdrop.desktop.AppletLauncher.java
projects.nerdybuzz.catchdrop.desktop.DesktopLauncher.java
projects.nerdybuzz.catchdrop.googleservices.DesktopGoogleServices.java
projects.nerdybuzz.catchdrop.googleservices.IGoogleServices.java