Commit 3911d303 authored by Matyáš Latner's avatar Matyáš Latner

#83 Blikající šipky nápovědy

parent 8ade0c92
......@@ -33,6 +33,8 @@ import org.andengine.entity.Entity;
import org.andengine.entity.IEntity;
import org.andengine.entity.modifier.AlphaModifier;
import org.andengine.entity.modifier.DelayModifier;
import org.andengine.entity.modifier.FadeInModifier;
import org.andengine.entity.modifier.FadeOutModifier;
import org.andengine.entity.modifier.LoopEntityModifier;
import org.andengine.entity.modifier.MoveModifier;
import org.andengine.entity.modifier.SequenceEntityModifier;
......@@ -292,9 +294,9 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
}
public void enablePulsing() {
AlphaModifier fadeIn = new AlphaModifier(1f, 0f, 1f);
FadeInModifier fadeIn = new FadeInModifier(1f);
fadeIn.setAutoUnregisterWhenFinished(true);
AlphaModifier fadeOut = new AlphaModifier(1f, 1f, 0f);
FadeOutModifier fadeOut = new FadeOutModifier(1f);
fadeOut.setAutoUnregisterWhenFinished(true);
SequenceEntityModifier sequenceModifier = new SequenceEntityModifier(fadeOut, fadeIn);
sequenceModifier.setAutoUnregisterWhenFinished(true);
......
......@@ -104,6 +104,7 @@ public class ResourceManager {
public static final String INFO_SAFE1 = ASSET_INFO + "safe1.png";
public static final String INFO_SAFE2 = ASSET_INFO + "safe2.png";
public static final String INFO_START_ARROW = ASSET_INFO + "start_arrow.png";
public static final String INFO_START_ARROW_BLINKER = ASSET_INFO + "start_arrow_blinker.png";
private static final String ASSET_SFX_SOURCE = ASSET_GAME + "sfx/";
......@@ -223,6 +224,7 @@ public class ResourceManager {
loadTexture(engine, context, INFO_SAFE1);
loadTexture(engine, context, INFO_SAFE2);
loadTexture(engine, context, INFO_START_ARROW);
loadTexture(engine, context, INFO_START_ARROW_BLINKER);
SoundFactory.setAssetBasePath(ASSET_SFX_SOURCE);
......
......@@ -26,6 +26,9 @@ import org.andengine.entity.Entity;
import org.andengine.entity.IEntity;
import org.andengine.entity.modifier.DelayModifier;
import org.andengine.entity.modifier.FadeInModifier;
import org.andengine.entity.modifier.FadeOutModifier;
import org.andengine.entity.modifier.LoopEntityModifier;
import org.andengine.entity.modifier.SequenceEntityModifier;
import org.andengine.entity.primitive.Rectangle;
import org.andengine.entity.scene.Scene;
import org.andengine.entity.sprite.Sprite;
......@@ -87,6 +90,7 @@ public class ActionsWidget extends Entity implements ActionListener {
}
}
private static final float TUTORIAL_INFO_ARROW_BLINK_DURATION = 1f;
private static final float TUTORIAL_INFO_ARROW_FADEIN_DELAY = 0.5f;
private static final int TOP_Z_INDEX = ActionType.values().length + 1;
private static final float BACKGROUND_WIDTH_RATIO = 1.3f;
......@@ -311,8 +315,25 @@ public class ActionsWidget extends Entity implements ActionListener {
START_ARROW_HEIGHT,
ResourceManager.getInstance().getTexture(ResourceManager.INFO_START_ARROW),
vertexBufferObjectManager);
final Sprite infoArrowBlinkerSprite = new Sprite(positionX + START_ARROW_X_OFFSET,
positionY - START_ARROW_Y_OFFSET,
START_ARROW_WIDTH,
START_ARROW_HEIGHT,
ResourceManager.getInstance().getTexture(ResourceManager.INFO_START_ARROW_BLINKER),
vertexBufferObjectManager);
infoArrowSprite.setAlpha(0);
infoArrowBlinkerSprite.setAlpha(0);
ActionLayer.INFO_LAYER.getLayerEntity().attachChild(infoArrowSprite);
ActionLayer.INFO_LAYER.getLayerEntity().attachChild(infoArrowBlinkerSprite);
FadeInModifier fadeIn = new FadeInModifier(TUTORIAL_INFO_ARROW_BLINK_DURATION);
fadeIn.setAutoUnregisterWhenFinished(true);
FadeOutModifier fadeOut = new FadeOutModifier(TUTORIAL_INFO_ARROW_BLINK_DURATION);
fadeOut.setAutoUnregisterWhenFinished(true);
final SequenceEntityModifier sequenceModifier = new SequenceEntityModifier(fadeIn, fadeOut);
sequenceModifier.setAutoUnregisterWhenFinished(true);
DelayModifier delayModifier = new DelayModifier(TUTORIAL_INFO_ARROW_FADEIN_DELAY);
delayModifier.setAutoUnregisterWhenFinished(true);
......@@ -323,6 +344,7 @@ public class ActionsWidget extends Entity implements ActionListener {
FadeInModifier fadeInModifier = new FadeInModifier(TUTORIAL_INFO_ARROW_FADEIN_DELAY);
fadeInModifier.setAutoUnregisterWhenFinished(true);
infoArrowSprite.registerEntityModifier(fadeInModifier);
infoArrowBlinkerSprite.registerEntityModifier(new LoopEntityModifier(sequenceModifier));
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment