Android Open Source - BlockBreaker Block Sprite






From Project

Back to project page BlockBreaker.

License

The source code is released under:

GNU General Public License

If you think the Android project BlockBreaker 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 de.hotware.blockbreaker.android.view;
/*from ww w  . jav a2s .c  o m*/
import org.andengine.entity.sprite.TiledSprite;
import org.andengine.input.touch.TouchEvent;
import org.andengine.opengl.texture.region.TiledTextureRegion;
import org.andengine.opengl.vbo.VertexBufferObjectManager;

import de.hotware.blockbreaker.android.view.listeners.IBlockSpriteTouchListener;
import de.hotware.blockbreaker.android.view.listeners.IBlockSpriteTouchListener.BlockSpriteTouchEvent;
import de.hotware.blockbreaker.model.Block;

public class BlockSprite extends TiledSprite {

  private static final float UNDEFINED_LOCATION = -999F;

  private IBlockSpriteTouchListener mBlockSpriteTouchListener;
  private Block mBlock;

  public BlockSprite(float pTileWidth, float pTileHeight, TiledTextureRegion pTiledTextureRegion, VertexBufferObjectManager pVertexBufferObjectManager) {
    super(UNDEFINED_LOCATION, UNDEFINED_LOCATION, pTileWidth, pTileHeight, pTiledTextureRegion, pVertexBufferObjectManager);
  }

  @Override
  public boolean onAreaTouched(TouchEvent pAreaTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY) {
    if(this.mBlockSpriteTouchListener != null && pAreaTouchEvent.isActionDown()) {
      this.mBlockSpriteTouchListener.onBlockSpriteTouch(new BlockSpriteTouchEvent(this, this.mBlock));
      return true;
    }
    return false;
  }

  @Override
  public void reset() {
    super.reset();
    this.clearUpdateHandlers();
    this.clearEntityModifiers();
    this.mBlock = null;
    this.mBlockSpriteTouchListener = null;
  }

  public IBlockSpriteTouchListener getBlockSpriteTouchListener() {
    return this.mBlockSpriteTouchListener;
  }

  public void setBlockSpriteTouchListener(IBlockSpriteTouchListener pBlockTouchListener) {
    this.mBlockSpriteTouchListener = pBlockTouchListener;
  }

  public Block getBlock() {
    return this.mBlock;
  }

  public void setBlock(Block pBlock) {
    this.mBlock = pBlock;
  }
}




Java Source Code List

de.hotware.blockbreaker.android.BlockBreakerActivity.java
de.hotware.blockbreaker.android.BlockBreakerLogoSplashScreenActivity.java
de.hotware.blockbreaker.android.BlockBreakerPreferencesActivity.java
de.hotware.blockbreaker.android.highscore.HighscoreSQLManager.java
de.hotware.blockbreaker.android.util.activities.BaseSplashScreenActivity.java
de.hotware.blockbreaker.android.view.BasicBlockPositionListener.java
de.hotware.blockbreaker.android.view.BlockSpritePool.java
de.hotware.blockbreaker.android.view.BlockSprite.java
de.hotware.blockbreaker.android.view.LevelSceneHandler.java
de.hotware.blockbreaker.android.view.UIConstants.java
de.hotware.blockbreaker.android.view.listeners.IBlockSpriteTouchListener.java