Ejemplo n.º 1
0
  public void jetfire() {
    GameScene scene = (GameScene) MainGameEngineActivity.getSharedInstance().mCurrentScene;

    pe = new PointParticleEmitter(this.getX(), this.getY());

    jps =
        new BatchedPseudoSpriteParticleSystem(
            pe, 8, 12, 200, ResourcesManager.getInstance().jetfire, scene.getVbom());
    jps.setBlendFunction(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE);
    jps.addParticleInitializer(new VelocityParticleInitializer<Entity>(0, 0, 0, -25));
    jps.addParticleInitializer(new AccelerationParticleInitializer<Entity>(5, -11));
    jps.addParticleInitializer(new RotationParticleInitializer<Entity>(0.0f, 360.0f));
    jps.addParticleInitializer(new ColorParticleInitializer<Entity>(1.0f, 1.0f, 0.0f));
    jps.addParticleInitializer(new ExpireParticleInitializer<Entity>(.8f, 2f));

    jps.addParticleModifier(new ScaleParticleModifier<Entity>(0, 5, 2.5f, 2.0f));
    jps.addParticleModifier(
        new ColorParticleModifier<Entity>(1.5f, 2.5f, 1.0f, 2.0f, 1.0f, 1.0f, 0.0f, 1.0f));
    jps.addParticleModifier(new AlphaParticleModifier<Entity>(1.5f, 2.5f, 1.0f, 0.0f));

    scene.attachChild(jps);
    jps.setParticlesSpawnEnabled(false);

    // BOOLEAN TO USE FOR START STO EMITION

  }
Ejemplo n.º 2
0
  public void shoot() {
    // Log.v("Player", "PLayer getting MainGameEngineActivity.getSharedInstance().mCurrentScene");

    GameScene scene = (GameScene) MainGameEngineActivity.getSharedInstance().mCurrentScene;
    Log.v("Player", "PLayer got MainGameEngineActivity.getSharedInstance().mCurrentScene");

    Bullet b = BulletPool.sharedBulletPool().obtainPoolItem();
    Log.v("Player", "Bullet b = BulletPool.sharedBulletPool().obtainPoolItem();");
    Log.v("Physics World", scene.getPhysicsWorld().toString());

    b.sprite.setPosition(this.getX(), this.getY());
    b.sprite.setVisible(true);
    b.sprite.detachSelf();

    scene.bulletCount++;
    scene.bulletList.add(b);
    scene.attachBullet(b);
  }