Android Open Source - Replica-Jump Enemy Large






From Project

Back to project page Replica-Jump.

License

The source code is released under:

GNU General Public License

If you think the Android project Replica-Jump 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.vinicius.dsl.replicajump.sprite;
/*from  w  w w.j  a v a  2s.com*/
import org.andengine.entity.modifier.RotationModifier;
import org.andengine.entity.sprite.Sprite;
import org.andengine.opengl.vbo.VertexBufferObjectManager;

import com.vinicius.dsl.replicajump.manager.GameManager;
import com.vinicius.dsl.replicajump.manager.ResourceManager;
import com.vinicius.dsl.replicajump.manager.SceneManager;
import com.vinicius.dsl.replicajump.util.Constants;

public class EnemyLarge extends Sprite{
  public EnemyLarge(float pX, float pY,
      VertexBufferObjectManager pVertexBufferObjectManager) {
    super(pX, pY, ResourceManager.getInstance().ENEMY_LARGE, pVertexBufferObjectManager);
    // TODO Auto-generated constructor stub
    this.setTag(0);
    this.registerEntityModifier(new RotationModifier(7f, 0, 360));
  }
  
  @Override
  protected void onManagedUpdate(float pSecondsElapsed) {
    // TODO Auto-generated method stubthis.registerEntityModifier(new MoveModifier(4f, this.getX(), this.getY(), this.getX()-200, this.getY()));
    if(!this.isDisposed() && this.collidesWith(GameManager.getInstance().player) && this.getTag()==0){
      this.setTag(1);
      GameManager.getInstance().player.die();
    }
    if(this.getX()<GameManager.getInstance().my_camera.getCenterX()-500){
       ResourceManager.getInstance().my_engine.runOnUpdateThread(new Runnable() {

                  @Override
                  public void run() {
                   setIgnoreUpdate(true);
                      EnemyLarge.this.clearUpdateHandlers();
                      EnemyLarge.this.detachSelf();
                      EnemyLarge.this.dispose();
                  }
              });
    }
    if( SceneManager.getInstance().actual_scene==Constants.SCENE_MAIN_MENU && this.getTag()==0){
        EnemyLarge.this.clearUpdateHandlers();
          EnemyLarge.this.detachSelf();
          EnemyLarge.this.dispose();
      } 
    super.onManagedUpdate(pSecondsElapsed);
  }
}




Java Source Code List

com.vinicius.dsl.replicajump.CustomCamera.java
com.vinicius.dsl.replicajump.ReplicaJumpActivity.java
com.vinicius.dsl.replicajump.level.Level1.java
com.vinicius.dsl.replicajump.level.LevelObject.java
com.vinicius.dsl.replicajump.manager.GameManager.java
com.vinicius.dsl.replicajump.manager.ResourceManager.java
com.vinicius.dsl.replicajump.manager.SceneManager.java
com.vinicius.dsl.replicajump.scene.LevelScene.java
com.vinicius.dsl.replicajump.scene.MainMenuScene.java
com.vinicius.dsl.replicajump.sprite.AndroidSprite.java
com.vinicius.dsl.replicajump.sprite.CoinGreen.java
com.vinicius.dsl.replicajump.sprite.CoinYellow.java
com.vinicius.dsl.replicajump.sprite.Enemy1.java
com.vinicius.dsl.replicajump.sprite.Enemy2.java
com.vinicius.dsl.replicajump.sprite.Enemy3.java
com.vinicius.dsl.replicajump.sprite.EnemyLarge.java
com.vinicius.dsl.replicajump.util.BasicScene.java
com.vinicius.dsl.replicajump.util.Constants.java
com.vinicius.dsl.replicajump.util.Preferences.java