protected void createExplosionMark(float x, float y) { final Sprite MARK = new TextureManagedSprite( 0, 0, HudRegions.region_explosion_mark, EnvironmentVars.MAIN_CONTEXT.getVertexBufferObjectManager()) { private float elapsedAliveTime; @Override protected void onManagedUpdate(float pSecondsElapsed) { this.elapsedAliveTime += pSecondsElapsed; if (this.elapsedAliveTime >= SessionScene.TARGET_ALIVE_EXPLOSION_MARK_TIME) { this.setAlpha(this.getAlpha() - 0.002f); if ((int) (this.getAlpha() * 1000) <= 0) EntityUtils.safetlyDetachAndDispose(this); } super.onManagedUpdate(pSecondsElapsed); } }; MARK.setScale(2f); MARK.setX(x - MARK.getWidth() / 2f); MARK.setY(y - MARK.getHeight() / 2f); this.attachChild(MARK); }
public void effectMiss(int mPosition) { int[] x = {50, 150, 250}; // Sprite sprite = new Sprite(0, 0, Region.miss, vbom); Sprite sprite = getMissFromPool(); // if (sprite.getParent() != this) { this.attachChild(sprite); // } setToCenter(sprite); sprite.setX(x[mPosition]); sprite.registerEntityModifier( new SequenceEntityModifier( new ScaleAtModifier(0.3f, 0, 1, sprite.getWidth() / 2, sprite.getHeight() / 2), new AlphaModifier(0.3f, 1, 1), new AlphaModifier(0.3f, 1, 0))); }