Android Open Source - fireflies_android Sprite






From Project

Back to project page fireflies_android.

License

The source code is released under:

MIT License

If you think the Android project fireflies_android 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 donothingbox.game.view;
/*  w w w .  ja va  2  s  .c  o  m*/
import android.graphics.Bitmap;
import android.graphics.Paint;
import android.graphics.Rect;

public class Sprite {
  
  public Bitmap mBitmap;
  public float x = 0;
  public float y = 0;
  public float vx = 0;
  public float vy = 0;
  public int rotation = 0;
  public Boolean visible = true;
  private float mAlpha = 255;
  public Paint mPaint;
  public float scale = 1.0f;
  public int depth = 0;
  
  
  public Sprite(Bitmap bitmap) {
    mBitmap = bitmap;
    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setFilterBitmap(true);
    mPaint.setDither(true);
  }
  
  public Bitmap getBitmap(){
    return mBitmap;  
  }
  
  public Rect getRect(){
    Rect bounds = new Rect();
    bounds.set((int)x, (int)y, (int)x + mBitmap.getWidth(), (int)y + mBitmap.getHeight());
    return bounds;
  }
  
  public int getAlpha(){
    return (int) mAlpha;
  }
  
  public void setAlpha(float alpha){
    if(alpha>100)
    {
      mAlpha = 100;
    }
    else if(alpha<=0)
    {
      mAlpha = 0;
    }
    else
      mAlpha = (int) alpha;
  }
  
  public void onTouched(){
    
  }
  
  public void updateGraphic(){
    
  }
}




Java Source Code List

com.donothingbox.fireflies_android.CoreApp.java
com.donothingbox.fireflies_android.DynamicActivity.java
com.donothingbox.fireflies_android.GameSurfaceActivity.java
com.donothingbox.fireflies_android.MainActivity.java
donothingbox.game.controller.AudioController.java
donothingbox.game.controller.GameThread.java
donothingbox.game.controller.HUDController.java
donothingbox.game.controller.StateController.java
donothingbox.game.model.DepthSortComparator.java
donothingbox.game.utils.BitmapUtils.java
donothingbox.game.utils.Utils.java
donothingbox.game.view.CustomDrawableView.java
donothingbox.game.view.FireflySprite.java
donothingbox.game.view.GameLayout.java
donothingbox.game.view.GameSurfaceView.java
donothingbox.game.view.Sprite.java