Commit c595dd1b authored by Matyáš Latner's avatar Matyáš Latner

#314 Zobrazení šipky pro nápovědu

 * zobrazení šipky s prodlevou
 * schování šipky po zařazení první akce
parent 2e86d1ed
obb/potme/gfx/obstacles/dog_attack.png

2.31 KB | W: | H:

obb/potme/gfx/obstacles/dog_attack.png

5.25 KB | W: | H:

obb/potme/gfx/obstacles/dog_attack.png
obb/potme/gfx/obstacles/dog_attack.png
obb/potme/gfx/obstacles/dog_attack.png
obb/potme/gfx/obstacles/dog_attack.png
  • 2-up
  • Swipe
  • Onion skin
obb/potme/gfx/obstacles/dog_sleep.png

2.65 KB | W: | H:

obb/potme/gfx/obstacles/dog_sleep.png

6.91 KB | W: | H:

obb/potme/gfx/obstacles/dog_sleep.png
obb/potme/gfx/obstacles/dog_sleep.png
obb/potme/gfx/obstacles/dog_sleep.png
obb/potme/gfx/obstacles/dog_sleep.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -166,6 +166,8 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
private static final int GAME_INFO_FINISH_ALPHA = 1;
private static final int GAME_INFO_START_ALPHA = 0;
private static final float GAME_INFO_APPEAR_DURATION = 0.3f;
private static final float GAME_INFO_ARROW_APPEAR_DURATION = 1f;
private static final int GAME_INFO_ARROW_APPEAR_DELAY = 2;
public static int TILE_SIZE;
public static int MAP_START_POSITION_X;
......@@ -259,6 +261,7 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
enabled = true;
changeActualButtonSprite(unpressedButtonSprite);
buttonText.setPosition(textUnpressedPositionX, textUnpressedPositionY);
hideStartArrowInfo();
}
public void disable() {
......@@ -378,7 +381,7 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
actionsStripWidget.setStartButton(startButton);
player = showPlayer();
prepareGameInfos();
prepareGameInfos(actionStripWidgetWidth);
prepareFadeLayer();
prepareKeyIcon();
......@@ -393,6 +396,7 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
goToPlanningMode();
super.showGame();
actionsWidget.showActions();
showStartArrowInfo();
}
/* //////////////////////////////////////////// BACKGROUND */
......@@ -762,36 +766,92 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
private Map<String, Sprite> gameInfos;
private void prepareGameInfos() {
private void prepareGameInfos(int actionStripWidgetWidth) {
gameInfos = new HashMap<String, Sprite>();
createCrashInfoSprite(ResourceManager.INFO_CRASH);
createCrashInfoSprite(ResourceManager.INFO_SAFE1);
createCrashInfoSprite(ResourceManager.INFO_SAFE2);
float gameInfoPositionX = MAP_START_POSITION_X + (mapWidgets.get(0).getWidth() / 2);
float gameInfoPositionY = MAP_START_POSITION_Y - (mapWidgets.get(0).getHeight() / 2);
float gameInfoWidth = TILE_SIZE * GAME_INFO_TILE_SIZE_MULTIPLIER;
float gameInfoHeight = TILE_SIZE * GAME_INFO_TILE_SIZE_MULTIPLIER;
createInfoSprite(GameLayer.INFO_LAYER, ResourceManager.INFO_CRASH, gameInfoPositionX, gameInfoPositionY, gameInfoWidth, gameInfoHeight);
createInfoSprite(GameLayer.INFO_LAYER, ResourceManager.INFO_SAFE1, gameInfoPositionX, gameInfoPositionY, gameInfoWidth, gameInfoHeight);
createInfoSprite(GameLayer.INFO_LAYER, ResourceManager.INFO_SAFE2, gameInfoPositionX, gameInfoPositionY, gameInfoWidth, gameInfoHeight);
float startArrowWidth = TILE_SIZE * 1.5f;
float startArrowHeight = TILE_SIZE * 1.5f;
float startPositionX = displaySize.x - actionStripWidgetWidth - ACTION_SIZE_SMALLER + (startArrowWidth * 2/3);
float startPositionY = MAP_START_POSITION_Y - mapWidgets.get(0).getHeight() + startArrowHeight;
createInfoSprite(GameLayer.BACKGROUND_DRAWING_LAYER, ResourceManager.INFO_START_ARROW, startPositionX, startPositionY, startArrowWidth, startArrowHeight);
}
private void showStartArrowInfo() {
scene.registerEntityModifier(new DelayModifier(GAME_INFO_ARROW_APPEAR_DELAY) {
@Override
protected void onModifierFinished(IEntity pItem) {
showGameInfo(ResourceManager.INFO_START_ARROW, true, GAME_INFO_ARROW_APPEAR_DURATION, null);
}
});
}
private void hideStartArrowInfo() {
hideGameInfo(ResourceManager.INFO_START_ARROW, true, null);
}
public void showCrashInfo() {
showGameInfo(ResourceManager.INFO_CRASH, true, null);
showGameInfo(ResourceManager.INFO_CRASH, true, GAME_INFO_APPEAR_DURATION, null);
}
public void showSafeInfo() {
showGameInfo(ResourceManager.INFO_SAFE1, true, new EntityModifierListenerAdapter(){
showGameInfo(ResourceManager.INFO_SAFE1, true, GAME_INFO_APPEAR_DURATION, new EntityModifierListenerAdapter(){
@Override
public void onModifierFinished(IModifier<IEntity> pModifier, IEntity pItem) {
showGameInfo(ResourceManager.INFO_SAFE2, false, null);
showGameInfo(ResourceManager.INFO_SAFE2, false, GAME_INFO_APPEAR_DURATION, null);
}
});
}
public void showGameInfo(String gameInfoTextureName, boolean animated, IModifierListener<IEntity> entityModifier) {
public void hideGameInfo(String gameInfoTextureName, boolean animated, final IModifierListener<IEntity> entityModifier) {
final Sprite gameInfoSprite = gameInfos.get(gameInfoTextureName);
if (gameInfoSprite.isVisible()) {
if (animated) {
gameInfoSprite.setAlpha(1.0f);
AlphaModifier alphaModifier = new AlphaModifier(GAME_INFO_APPEAR_DURATION, GAME_INFO_FINISH_ALPHA, GAME_INFO_START_ALPHA, EaseStrongOut.getInstance());
alphaModifier.addModifierListener(new IModifierListener<IEntity>() {
@Override
public void onModifierStarted(IModifier<IEntity> pModifier, IEntity pItem) {
if (entityModifier != null) {
entityModifier.onModifierStarted(pModifier, pItem);
}
}
@Override
public void onModifierFinished(IModifier<IEntity> pModifier, IEntity pItem) {
gameInfoSprite.setVisible(false);
if (entityModifier != null) {
entityModifier.onModifierFinished(pModifier, pItem);
}
}
});
gameInfoSprite.registerEntityModifier(alphaModifier);
} else {
gameInfoSprite.setVisible(false);
}
}
}
public void showGameInfo(String gameInfoTextureName, boolean animated, float animationDuration, IModifierListener<IEntity> entityModifier) {
hideGameInfos();
Sprite gameInfoSprite = gameInfos.get(gameInfoTextureName);
if (animated) {
gameInfoSprite.setAlpha(0);
gameInfoSprite.setVisible(true);
AlphaModifier alphaModifier = new AlphaModifier(GAME_INFO_APPEAR_DURATION, GAME_INFO_START_ALPHA, GAME_INFO_FINISH_ALPHA, EaseStrongOut.getInstance());
AlphaModifier alphaModifier = new AlphaModifier(animationDuration, GAME_INFO_START_ALPHA, GAME_INFO_FINISH_ALPHA, EaseStrongOut.getInstance());
alphaModifier.addModifierListener(entityModifier);
gameInfoSprite.registerEntityModifier(alphaModifier);
} else {
......@@ -805,15 +865,15 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
}
}
private void createCrashInfoSprite(String textureName) {
Sprite gameInfoSprite = new Sprite(MAP_START_POSITION_X + (mapWidgets.get(0).getWidth() / 2),
MAP_START_POSITION_Y - (mapWidgets.get(0).getHeight() / 2),
TILE_SIZE * GAME_INFO_TILE_SIZE_MULTIPLIER,
TILE_SIZE * GAME_INFO_TILE_SIZE_MULTIPLIER,
private void createInfoSprite(GameLayer gameLayer, String textureName, float positionX, float positionY, float width, float height) {
Sprite gameInfoSprite = new Sprite(positionX,
positionY,
width,
height,
ResourceManager.getInstance().getTexture(textureName),
getVertexBufferObjectManager());
gameInfoSprite.setVisible(false);
GameLayer.INFO_LAYER.getLayerEntity().attachChild(gameInfoSprite);
gameLayer.getLayerEntity().attachChild(gameInfoSprite);
gameInfos.put(textureName, gameInfoSprite);
}
......
......@@ -103,6 +103,7 @@ public class ResourceManager {
public static final String INFO_CRASH = ASSET_INFO + "crash.png";
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";
private static final String ASSET_SFX_SOURCE = ASSET_GAME + "sfx/";
......@@ -221,6 +222,7 @@ public class ResourceManager {
loadTexture(engine, context, INFO_CRASH);
loadTexture(engine, context, INFO_SAFE1);
loadTexture(engine, context, INFO_SAFE2);
loadTexture(engine, context, INFO_START_ARROW);
SoundFactory.setAssetBasePath(ASSET_SFX_SOURCE);
......
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