Commit 2e86d1ed authored by Matyáš Latner's avatar Matyáš Latner

#310 Zrychlení zvuku chůze hráče

parent d3dd9479
package cz.nic.tablexia.game.games.potme;
import org.andengine.audio.sound.Sound;
import org.andengine.engine.Engine;
import org.andengine.entity.IEntity;
......@@ -62,7 +63,13 @@ public class UtilityAccess {
}
public void playRandomSoundFromGroup(String[] soundGroup) {
ResourceManager.getInstance().getSound(soundGroup[randomAccess.getRandom().nextInt(soundGroup.length)]).play();
playRandomSoundFromGroup(soundGroup, 1.0f);
};
public void playRandomSoundFromGroup(String[] soundGroup, float rate) {
Sound sound = ResourceManager.getInstance().getSound(soundGroup[randomAccess.getRandom().nextInt(soundGroup.length)]);
sound.setRate(rate);
sound.play();
}
}
......@@ -49,6 +49,7 @@ import cz.nic.tablexia.game.games.potme.map.tile.TileType;
@SuppressLint("RtlHardcoded") // weird behaviour of Eclipse
public class Player extends Entity {
private static final float PLAYER_WALK_SOUND_RATE = 1.2f;
private static final int PLAYER_WALK_ANIMATION_FRAMES = 8;
private static final int PLAYER_JUMP_ANIMATION_FRAMES = 6;
private static final int PLAYER_CRASH_ANIMATION_FRAMES = 7;
......@@ -212,7 +213,7 @@ public class Player extends Entity {
if (modifierListener != null) {
modifierListener.onModifierStarted(modifier, item);
}
UtilityAccess.getInstance().playRandomSoundFromGroup(ResourceManager.STEPS);
UtilityAccess.getInstance().playRandomSoundFromGroup(ResourceManager.STEPS, PLAYER_WALK_SOUND_RATE);
}
@Override
......
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