public Basic(Matrix4 transform, double speeed, int hp, int health, int range, float coolDown, EnumSet<Types> types, EnumSet<Effects> effects, ModelInstance instance, btCollisionWorld world, IntMap<Entity> entities, List<Vector3> path, Map<String, Sound> sounds) { super(transform, speeed, hp, health, range, coolDown, types, effects, instance, new btCompoundShape(), world, entities, ATTACK_ANIMATION, ATTACK_OFFSET, path, sounds); ((btCompoundShape)shape).addChildShape(new Matrix4(new Vector3(0, 30, 0), new Quaternion().setEulerAngles(0, 0, 0), new Vector3(1, 1, 1)), new btBoxShape(new Vector3(75, 30, 90))); //System.out.println(getModelInstance().getAnimation("Spider_Armature|walk_ani_vor").id); listener = new AnimationController.AnimationListener() { @Override public void onEnd(AnimationController.AnimationDesc animationDesc) { } @Override public void onLoop(AnimationController.AnimationDesc animationDesc) { } }; //animation.setAnimation("Spider_Armature|walk_ani_vor"); //animation.animate("Spider_Armature|walk_ani_vor", -1); //animation.action("Spider_Armature|walk_ani_vor", 0, 1000, -1, 1, listener, 0); //animation.animate("Spider_Armature|Attack", 0, 1000, 1, 1, listener, 0); //animation.queue("Spider_Armature|walk_ani_vor", 0, 1000, -1, 1, listener, 0); }
public Ion(float posX, float posY, boolean flip) { speed = 400; lifeTime = 180; flashLTime = 25; damage = 2; alive = true; this.posX = posX; this.posY = posY; bulletTexture = AssetLoader.assetManager.get("ion.png", Texture.class); bulletFlash = AssetLoader.assetManager.get("ionflash.png", Texture.class); bulletSound = AssetLoader.assetManager.get("ionsnd.wav", Sound.class); if(!flip) bulletSound.play(); sprite = new Sprite(bulletTexture); sprite.setOriginCenter(); sprite.setPosition(this.posX,this.posY); this.flip = flip; if(flip) sprite.setRotation(180); }
public Rocket(float posX, float posY, boolean flip) { speed = 300; lifeTime = 180; flashLTime = 25; damage = 3; alive = true; this.posX = posX; this.posY = posY; bulletTexture = AssetLoader.assetManager.get("bullet.png", Texture.class); bulletFlash = AssetLoader.assetManager.get("bulletflash.png", Texture.class); bulletSound = AssetLoader.assetManager.get("bulletsnd.wav", Sound.class); if(!flip) bulletSound.play(0.5f); sprite = new Sprite(bulletTexture); sprite.setOriginCenter(); this.flip = flip; if(flip) sprite.setRotation(180); }
public Player() { super(0, 0); this.x = (float) (GameScreen.earth.getXCenter() + radius * Math.sin(angle)); this.y = (float) (GameScreen.earth.getYCenter() + radius * Math.cos(angle)); img = new Sprite(new Texture(Gdx.files.internal("player.png"))); shoot = new Sound[4]; for (int i = 1; i <= shoot.length; i++) { shoot[i - 1] = Gdx.audio.newSound(Gdx.files.internal("sound/shoot" + i + ".wav")); } }
private void loadAssets() { InternalFileHandleResolver fileHandler = new InternalFileHandleResolver(); assetManager = new AssetManager(fileHandler); assetManager.setLoader(FreeTypeFontGenerator.class, new FreeTypeFontGeneratorLoader(fileHandler)); assetManager.load(SKIN_PATH, Skin.class); assetManager.load(MASTER_PATH, TextureAtlas.class); assetManager.load(FONT_NORMAL_PATH, FreeTypeFontGenerator.class); assetManager.load(FONT_BOLD_PATH, FreeTypeFontGenerator.class); assetManager.load(MUSIC_PATH, Music.class); assetManager.load(MAIN_MENU_MUSIC_PATH, Music.class); assetManager.load(GOOD_PATH, Sound.class); assetManager.load(HALF_PATH, Sound.class); assetManager.load(BAD_PATH, Sound.class); assetManager.finishLoading(); }
public void loadAssets() { assetManager.clear(); assetManager.load(DATA_PATH + "/skin/skin.json", Skin.class); for (String directory : imagePacks.keys()) { FileHandle folder = Gdx.files.local(directory); for (FileHandle file : folder.list()) { assetManager.load(file.path(), Pixmap.class); imagePacks.get(directory).add(file.nameWithoutExtension()); } } assetManager.load(DATA_PATH + "/gfx/white.png", Pixmap.class); assetManager.load(DATA_PATH + "/sfx/coin.wav", Sound.class); assetManager.load(DATA_PATH + "/sfx/hit.wav", Sound.class); assetManager.load(DATA_PATH + "/sfx/jump.wav", Sound.class); }
/** * Erstellt einen Sound in der Sound-Datenbank und lädt ihn. * * @see AudioManager#createSound(String, String) * @see AudioManager#unloadSound(SoundKey) * @see AudioManager#playSound(SoundKey) * @see AudioManager#playSound(SoundKey, float) * * @param group zu welcher Gruppe gehört der Sound? * @param name der Name der Sounddatei mit Endung * @param autoUnload true damit der Sound beim Beenden ohne Warnung entladen wird. Sparsam benutzen. * @return ein Verweis auf den Sound der zum Abspielen benutzt werden kann */ public SoundKey createSound(String group, String name, boolean autoUnload) { String soundId = group + "/" +name; if (soundMap.containsKey(soundId)) return new SoundKey(soundId); Sound sound = Gdx.audio.newSound(Gdx.files.internal("data/sound/" + soundId)); soundMap.put(soundId, sound); SoundKey soundKey = new SoundKey(soundId); if (autoUnload) autoUnloadSounds.add(soundKey); return soundKey; }
/** * Wird aufgerufen, wenn der AudioManager nicht mehr benötigt wird. * Sollten noch Musik oder Sounds geladen sein, werden sie gestoppt und entladen. */ public void dispose() { stopMusic(); for (SoundKey soundKey : autoUnloadSounds) { unloadSound(soundKey); } if (!soundMap.isEmpty()) { Gdx.app.log("DEBUG", "Some sounds (" + soundMap.size() + ") weren't unloaded by their creators!"); for (Map.Entry<String, Sound> sound : soundMap.entrySet()) { Gdx.app.log("DEBUG", "Auto unloading: " + sound.getKey()); sound.getValue().stop(); sound.getValue().dispose(); } } }
public CutsceneStoneAge(MyGdxGame myGdxGame) { this.myGdxGame = myGdxGame; batch = myGdxGame.batch; sr = myGdxGame.sr; viewport = myGdxGame.viewport; camera = myGdxGame.camera; font = myGdxGame.font; particles = new Particles(); bg = new Sprite(new Texture("sprites/orange.png")); girl = new Sprite(new Texture("sprites/girl.png")); stone = new Sprite(new Texture("sprites/stein_angemalt.png")); hominideSitzend = new Sprite(new Texture("sprites/hominide_sitzend.png")); hominideDuckend = new Sprite(new Texture("sprites/hominide_duckend.png")); hominideStehend = new Sprite(new Texture("sprites/hominide_stehend.png")); assetManager = new AssetManager(); assetManager.load("music/tusch.mp3", Sound.class); assetManager.load("music/5_steinzeit.mp3", Music.class); assetManager.finishLoading(); tusch = assetManager.get("music/tusch.mp3", Sound.class); musicStoneAge = assetManager.get("music/5_steinzeit.mp3", Music.class); }
/** * Loads a sound effect and associates it with its path. * @param fileName */ private void loadSfx(final String fileName) { if (!sfx.containsKey(fileName)) { Sound soundeffect = Gdx.audio.newSound(Gdx.files.internal(fileName)); sfx.put(fileName, soundeffect); } }
/** * Load the sounds and musics used in the game. */ private void loadSounds() { assetManager.load("music/Artofescapism_-_Three_Star_Sky.mp3", Music.class); assetManager.load("music/item.mp3", Sound.class); assetManager.load("music/jump.wav", Sound.class); assetManager.load("music/lost.wav", Sound.class); assetManager.load("music/won.wav", Sound.class); assetManager.load("music/water.wav", Sound.class); }
public void init(AssetManager assetManager) { this.assetManager = assetManager; assetManager.setErrorListener(this); assetManager.load(TEXTURE_ATLAS_OBJECTS, TextureAtlas.class); // load sounds assetManager.load("sounds/jump.wav", Sound.class); assetManager.load("sounds/jump_with_feather.wav", Sound.class); assetManager.load("sounds/pickup_coin.wav", Sound.class); assetManager.load("sounds/pickup_feather.wav", Sound.class); assetManager.load("sounds/live_lost.wav", Sound.class); // load music assetManager.load("music/hair.ogg", Music.class); assetManager.finishLoading(); Gdx.app.debug(TAG, "# of assets loaded: " + assetManager.getAssetNames().size); for (String a : assetManager.getAssetNames()) { Gdx.app.debug(TAG, "asset: " + a); } TextureAtlas atlas = assetManager.get(TEXTURE_ATLAS_OBJECTS); //激活平滑文理过度 for (Texture t : atlas.getTextures()) { t.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear); } //创建游戏资源对象 bunny = new AssetBunny(atlas); rock = new AssetRock(atlas); goldCoin = new AssetGoldCoin(atlas); feather = new AssetFeather(atlas); levelDecoration = new AssetLevelDecoration(atlas); sounds = new AssetSounds(assetManager); music = new AssetMusic(assetManager); fonts = new AssetFonts(); }
public AssetSounds(AssetManager am) { jump = am.get("sounds/jump.wav", Sound.class); jumpWithFeather = am.get("sounds/jump_with_feather.wav", Sound.class); pickupCoin = am.get("sounds/pickup_coin.wav", Sound.class); pickupFeather = am.get("sounds/pickup_feather.wav", Sound.class); liveLost = am.get("sounds/live_lost.wav", Sound.class); }
public void loadAudio() { assetManager.load(MusicAsset.SOUND_MUSIC_MP3, Music.class); assetManager.load(SoundAsset.SOUND_EXPLOSION_WAV, Sound.class); assetManager.load(SoundAsset.SOUND_SHOOT_WAV, Sound.class); assetManager.load(SoundAsset.SOUND_POWERUP_WAV, Sound.class); assetManager.load(SoundAsset.BOMB_DROP, Sound.class); assetManager.load(SoundAsset.FIRE_MISSILE, Sound.class); assetManager.update(); }
public HealthPack() { posX = MathUtils.random(350)+ 50; posY = Gdx.graphics.getHeight(); speed = 150f; texture = AssetLoader.assetManager.get("medkit.png", Texture.class); powerUpSound = AssetLoader.assetManager.get("powerupsnd.wav", Sound.class); sprite = new Sprite(texture); sprite.setOriginCenter(); sprite.setScale(0.7f); sprite.setPosition(posX, posY); }
public AmmoPack() { posX = MathUtils.random(350)+ 50; posY = Gdx.graphics.getHeight(); speed = 150f; texture = AssetLoader.assetManager.get("ammo.png", Texture.class); powerUpSound = AssetLoader.assetManager.get("powerupsnd.wav", Sound.class); sprite = new Sprite(texture); sprite.setOriginCenter(); sprite.setScale(0.7f); sprite.setPosition(posX, posY); }
public UpgradePack() { posX = MathUtils.random(350)+ 50; posY = Gdx.graphics.getHeight(); speed = 150f; texture = AssetLoader.assetManager.get("upgrade.png", Texture.class); powerUpSound = AssetLoader.assetManager.get("powerupsnd.wav", Sound.class); sprite = new Sprite(texture); sprite.setOriginCenter(); sprite.setScale(0.7f); sprite.setPosition(posX, posY); }
private static void load() { //Spaceship textures assetManager.load("spaceshipHull.png", Texture.class); assetManager.load("spaceshipGun.png", Texture.class); assetManager.load("spaceshipJet.png", Texture.class); //Spaceship powerups assetManager.load("ammo.png", Texture.class); assetManager.load("medkit.png", Texture.class); assetManager.load("upgrade.png", Texture.class); assetManager.load("god.png", Texture.class); assetManager.load("powerupsnd.wav", Sound.class); //Bullet textures assetManager.load("bullet.png", Texture.class); assetManager.load("bulletflash.png", Texture.class); assetManager.load("bulletsnd.wav", Sound.class); //Ion textures assetManager.load("ion.png", Texture.class); assetManager.load("ionflash.png", Texture.class); assetManager.load("ionsnd.wav", Sound.class); //Explosion textureAtlas assetManager.load("explosion.pack", TextureAtlas.class); //Enemy texture assetManager.load("weakenemy.png", Texture.class); //Dunno assetManager.load("sans.fnt", BitmapFont.class); assetManager.load("background.png", Texture.class); }
@Override public void onResume() { // load assets assetManager.load(BG_IMAGE_PATH, Texture.class); assetManager.load(SELECT_SOUND_PATH, Sound.class); // load assets assetManager.finishLoadingAsset(BG_IMAGE_PATH); assetManager.finishLoadingAsset(SELECT_SOUND_PATH); // get assets this.bgImage = assetManager.get(BG_IMAGE_PATH, Texture.class); Sound selectSound = assetManager.get(SELECT_SOUND_PATH, Sound.class); // set hover sounds this.newGameButton.setHoverSound(selectSound); this.multiplayerButton.setHoverSound(selectSound); this.creditsButton.setHoverSound(selectSound); this.settingsButton.setHoverSound(selectSound); // load and get soundtrack assetManager.load(MUSIC_PATH, Music.class); assetManager.finishLoadingAsset(MUSIC_PATH); this.music = assetManager.get(MUSIC_PATH, Music.class); // play background music this.music.setVolume(VolumeManager.getInstance().getBackgroundMusicVolume()); this.music.setLooping(true); this.music.play(); }
@Override protected void onInit(ScreenBasedGame game, AssetManager assetManager) { // load & get assets game.getAssetManager().load(GAMEOVER_SOUND_PATH, Sound.class); game.getAssetManager().load(BG_IMAGE_PATH, Texture.class); game.getAssetManager().finishLoadingAsset(GAMEOVER_SOUND_PATH); game.getAssetManager().finishLoadingAsset(BG_IMAGE_PATH); sound = game.getAssetManager().get(GAMEOVER_SOUND_PATH); this.bgTexture = game.getAssetManager().get(BG_IMAGE_PATH); // generate fonts this.font = BitmapFontFactory.createFont("./data/font/spartakus/SparTakus.ttf", 48, Color.WHITE, Color.BLUE, 3); this.buttonFont = BitmapFontFactory.createFont("data/font/arial/arial.ttf", 32, Color.WHITE); //back to menu button this.menuButton = new TextButton("Back to Menu", this.buttonFont); this.menuButton.setDimension(/* 200 */400, /* 50 */50); this.menuButton.setPosition(game.getViewportWidth() / 2 - (menuButton.getWidth() / 2), 260); this.menuButton.setClickListener(() -> game.getScreenManager().leaveAllAndEnter("menu")); //replay button this.replayButton = new TextButton("Replay", this.buttonFont); this.replayButton.setDimension(400, 50); this.replayButton.setPosition(game.getViewportWidth() / 2 - (menuButton.getWidth() / 2), 200); this.replayButton.setClickListener(() -> { game.getScreenManager().leaveAllAndEnter("game"); }); }
@Override protected void onInit(BaseGame game, Entity entity) { this.collisionComponent.addCollisionListener(this); // load sound game.getAssetManager().load(soundPath, Sound.class); game.getAssetManager().finishLoadingAsset(soundPath); // get sound this.sound = game.getAssetManager().get(soundPath); }
public Meteorite(Sprite[] textures, Sprite[] warning, Sound sound) { super(0, 0); this.sound = sound; Random r = new Random(); int direction = r.nextInt(360 + 1); health = r.nextInt(2) + 3; float tempVelY = (float) (10 * Math.cos(Math.toRadians(direction))); float tempVelX = (float) (10 * Math.sin(Math.toRadians(direction))); if (r.nextInt(2) == 0) tempVelX *= -1; if (r.nextInt(2) == 0) tempVelY *= -1; Rectangle collision = new Rectangle((int) GameScreen.earth.getXCenter(), (int) GameScreen.earth.getYCenter(), radius * 2, radius * 2); Rectangle screen = new Rectangle(0, 0, Game.WIDTH, Game.HEIGHT); while (collision.overlaps(screen)) { collision.setPosition(collision.x + tempVelX, collision.y + tempVelY); } warningRect = new Rectangle(collision.x, collision.y, 50, 50); while (!warningRect.overlaps(screen)) { warningRect.setPosition(collision.x - tempVelX * 15, collision.y - tempVelY * 15); } x = (float) collision.getX(); y = (float) collision.getY(); float xSpeed = (Game.WIDTH / 2 - x) / 1.0f; float ySpeed = (Game.HEIGHT / 2 - y) / 1.0f; float factor = (float) (speed / Math.sqrt(xSpeed * xSpeed + ySpeed * ySpeed)); xSpeed *= factor; ySpeed *= factor; velX = xSpeed; velY = ySpeed; this.collision = new Circle(x - radius, y - radius, radius); this.img = textures; this.warning = warning; warningTime = System.currentTimeMillis() + 3000; }
public AttackingEntity(Matrix4 transform, int hp, int health, int range, EnumSet<Types> types, EnumSet<Effects> effects, float coolDown, ModelInstance instance, btCollisionShape shape, btCollisionWorld world, IntMap<Entity> entities, String attackAnimation, Vector3 attackOffset, Map<String, Sound> sounds){ super(transform, hp, health, types, effects, instance, shape, world, entities, sounds); this.coolDown = coolDown; this.range = range; this.attackAnimation = attackAnimation; this.attackOffset = attackOffset; callback = new ClosestRayResultCallback(new Vector3(), new Vector3()); }
public Entity(Matrix4 transform, int hp, int health, EnumSet<Types> types, EnumSet<Effects> effects, ModelInstance instance, btCollisionShape shape, btCollisionWorld world, IntMap<Entity> entities, Map<String, Sound> sounds){ this.instance = instance; this.transform = transform; this.hp = hp; this.types = types; this.health = health; this.effects = effects; this.sounds = sounds; animation = new AnimationController(instance); this.instance.transform.set(transform); this.shape = shape; body = new btCollisionObject(); body.setCollisionShape(shape); body.setWorldTransform(this.instance.transform); this.world = world; tempVector = new Vector3(); tempVector2 = new Vector3(); this.entities = entities; tempQuaternion = new Quaternion(); quaternion = new Quaternion(); if(this instanceof Enemy || this instanceof Projectile) body.setCollisionFlags(body.getCollisionFlags()); int index = getNextIndex(); entities.put(index, this); body.setUserValue(index); world.addCollisionObject(body); boundingBox = instance.calculateBoundingBox(new BoundingBox()); //for(Node node: instance.nodes) //System.out.println(); }
public Gun(Matrix4 transform, int hp, int health, int range, float cooldown, EnumSet<Types> types, EnumSet<Effects> effects, ModelInstance instance, btCollisionShape shape, btCollisionWorld world, IntMap<Entity> entities, String attack, EntityTemplate<Bullet> projectile, Vector3 attackOffset, Map<String, Sound> sounds) { super(transform, hp, health, range, cooldown, types, effects, instance, shape, world, entities, attack, projectile, attackOffset, sounds); nodes = new HashMap<String, Node>(); /*for(Node node: instance.model.nodes) { System.out.println(node.id); if (node.id.startsWith("Leg")) { legs.add(node); } }*/ //legs.get(0).rotation.setEulerAngles(100, 0, 0); for(Node node: instance.getNode("Gun_root").getChildren()) nodes.put(node.id, node); }
public EnemySpawner(Vector3 pos, Map<String, Class<?>> enemyClasses, List<Spawn> spawns, Map<String, Model> models, List<Enemy> enemies, List<Vector3> path, btCollisionWorld world, IntMap<Entity> entities, Map<String, Sound> sounds) { this.enemies = enemies; this.pos = pos; this.enemyClasses = enemyClasses; this.models = models; this.spawns = spawns; this.path = path; this.world = world; this.entity = entities; this.sounds = sounds; System.out.println(spawns); }
public Projectile(Matrix4 transform, Vector3 velocity, int hp, int health, float speed, EnumSet<Types> types, EnumSet<Effects> effects, ModelInstance model, btCollisionShape shape, boolean isTower, btCollisionWorld world, IntMap<Entity> entities, float lifetime, Map<String, Sound> sounds) { super(transform, hp, health, types, effects, model, shape, world, entities, sounds); this.isTower = isTower; this.velocity = velocity; this.velocity.scl(speed); this.lifetime = lifetime; }
public AssetsSound() { manager = new AssetManager(); manager.load(NameSound.fx_glitch3mp3,Sound.class); manager.load(NameSound.fx_glitch4mp3,Sound.class); manager.load(NameSound.fx_glitch5mp3,Sound.class); manager.load(NameSound.tr_escape_changes_survivemp3,Sound.class); manager.load(NameSound.tr_escape_countingsecondsmp3,Sound.class); manager.load(NameSound.tr_escape_radioactiveogg,Sound.class); }
private void loadAssets() { // playSplashTune(); // manager.load("fonts/impact_150_mono.fnt", BitmapFont.class); manager.load(DS.TEXTURE_ATLAS + ".atlas", TextureAtlas.class); // manager.load("audio/fingerless.wav", Music.class); manager.load("audio/mad_world_02.mp3", Music.class); manager.load("audio/game_over.mp3", Music.class); manager.load("audio/shot_sfx.wav", Sound.class); manager.load("audio/explosion_sfx.wav", Sound.class); manager.load("audio/explosion_03.wav", Sound.class); manager.load("audio/yee.wav", Sound.class); }
private void setupAudio() { DS.gameMusic = manager.get("audio/mad_world_02.mp3", Music.class); DS.gameOverMusic = manager.get("audio/game_over.mp3", Music.class); DS.gameMusic.setLooping(true); DS.shotSound = manager.get("audio/shot_sfx.wav", Sound.class); DS.explosionSound = manager.get("audio/explosion_sfx.wav", Sound.class); DS.fryBombSound = manager.get("audio/explosion_03.wav", Sound.class); DS.cheerSound = manager.get("audio/yee.wav", Sound.class); }
private static void addClassTypes() { classTypes.put("png", Texture.class); classTypes.put("jpg", Texture.class); classTypes.put("bmp", Texture.class); classTypes.put("gif", Texture.class); classTypes.put("mp3", Music.class); classTypes.put("ogg", Sound.class); classTypes.put("tmx", TiledMap.class); }
@Override public void create() { setTextureRegion(getCore().getAtlas().findRegion(((GameState) getCore().getStateManager().getState("game")).getSelectedCharacter())); setX(50); setY(Gdx.graphics.getHeight() / 2.0f - getTextureRegion().getRegionHeight() / 2.0f); setOffsetX(getTextureRegion().getRegionWidth() / 2.0f); setOffsetY(getTextureRegion().getRegionHeight() / 2.0f); getCollisionBox().setSize(getTextureRegion().getRegionWidth() / 2.0f, getTextureRegion().getRegionHeight() / 2.0f); jump = getCore().getAssetManager().get(Core.DATA_PATH + "/sfx/jump.wav", Sound.class); hit = getCore().getAssetManager().get(Core.DATA_PATH + "/sfx/hit.wav", Sound.class); coin = getCore().getAssetManager().get(Core.DATA_PATH + "/sfx/coin.wav", Sound.class); }
private void createMenu() { root = new Table(); root.setFillParent(true); stage.addActor(root); FileHandle fileHandle = Gdx.files.local(Core.DATA_PATH + "/data.json"); JsonReader reader = new JsonReader(); JsonValue val = reader.parse(fileHandle); Label title = new Label(val.getString("title"), skin, "title"); root.add(title).padTop(50.0f).padBottom(75.0f); root.row(); BouncingImage image = new BouncingImage(getCharacter()); root.add(image); root.row(); ImageButton imageButton = new ImageButton(skin, "play"); root.add(imageButton).padTop(75.0f).expandY().top(); imageButton.addListener(new ChangeListener() { @Override public void changed(ChangeListener.ChangeEvent event, Actor actor) { getCore().getAssetManager().get(Core.DATA_PATH + "/sfx/jump.wav", Sound.class).play(); showCharacterDialog(); } }); }
/** * Standardkonstruktor * * @param game Spielinstanz */ public AudioManager(SchoolGame game) { this.game = game; muteMusic = game.getPreferences().getBoolean("mute_music", false); muteSound = game.getPreferences().getBoolean("mute_sound", false); soundMap = new HashMap<String, Sound>(); autoUnloadSounds = new ArrayList<SoundKey>(); }
/** * Entlädt einen Sound aus dem Speicher und entfernt ihn aus der Datenbank. * * @see AudioManager#createSound(String, String) * @see AudioManager#createSound(String, String, boolean) * * @param soundKey der Verweis auf den Sound */ public void unloadSound(SoundKey soundKey) { if (soundKey == null) return; String soundId = soundKey.getSoundId(); if (soundMap.containsKey(soundId)) { Sound sound = soundMap.get(soundId); sound.stop(); sound.dispose(); soundMap.remove(soundId); } }
public void removeSound(String key) { Sound sound = sounds.get(key); if (sound != null) { sound.dispose(); } sounds.remove(key); }
/** * Load all assets into the assets folder */ private void loadAssets() { assetManager.load("audio/jump.mp3", Sound.class); assetManager.load("audio/level_1_music.mp3", Music.class); assetManager.load("audio/level_2_music.mp3", Music.class); assetManager.load("sprites/splashscreen/splashscreen.png", Texture.class); assetManager.finishLoading(); }
public CutsceneMedieval(MyGdxGame myGdxGame) { this.myGdxGame = myGdxGame; batch = myGdxGame.batch; sr = myGdxGame.sr; viewport = myGdxGame.viewport; camera = myGdxGame.camera; font = myGdxGame.font; particles = new Particles(); bg = new Sprite(new Texture("sprites/red.png")); girl = new Sprite(new Texture("sprites/girl.png")); king = new Sprite(new Texture("sprites/king.png")); mother = new Sprite(new Texture("sprites/mother.png")); girldBurned1 = new Sprite(new Texture("sprites/girl_burned1.png")); girldBurned2 = new Sprite(new Texture("sprites/girl_burned2.png")); girldBurned3 = new Sprite(new Texture("sprites/girl_burned3.png")); girldBurned4 = new Sprite(new Texture("sprites/girl_burned4.png")); assetManager = new AssetManager(); assetManager.load("music/tusch.mp3", Sound.class); assetManager.load("music/iHaveBurned.mp3", Music.class); assetManager.load("music/slap.mp3", Sound.class); assetManager.load("music/4_mittelalter.mp3", Music.class); assetManager.finishLoading(); slap = assetManager.get("music/slap.mp3", Sound.class); tusch = assetManager.get("music/tusch.mp3", Sound.class); mittelalter = assetManager.get("music/4_mittelalter.mp3", Music.class); iHaveBurned = assetManager.get("music/iHaveBurned.mp3", Music.class); }
public CutsceneModernTimes(MyGdxGame myGdxGame) { this.myGdxGame = myGdxGame; batch = myGdxGame.batch; sr = myGdxGame.sr; viewport = myGdxGame.viewport; camera = myGdxGame.camera; font = myGdxGame.font; bg = new Sprite(new Texture("sprites/curscene1bg.png")); girl = new Sprite(new Texture("sprites/girl.png")); knife = new Sprite(new Texture("sprites/knife.png")); human1 = new Sprite(new Texture("sprites/human1.png")); human2 = new Sprite(new Texture("sprites/human2.png")); girlStabbed1 = new Sprite(new Texture("sprites/girl_stabbed1.png")); girlStabbed2 = new Sprite(new Texture("sprites/girl_stabbed2.png")); girlStabbed3 = new Sprite(new Texture("sprites/girl_stabbed3.png")); girlStabbed4 = new Sprite(new Texture("sprites/girl_stabbed4.png")); assetManager = new AssetManager(); assetManager.load("music/1_iCutMyself.mp3", Music.class); assetManager.load("music/2_dadFindsHer.mp3", Music.class); assetManager.load("music/iHavePaintedTheStone.mp3", Music.class); assetManager.load("music/knifeDrop.mp3", Sound.class); assetManager.finishLoading(); iCutMyself = assetManager.get("music/1_iCutMyself.mp3", Music.class); dadFindsHer = assetManager.get("music/2_dadFindsHer.mp3", Music.class); iHavePaintedTheStone = assetManager.get("music/iHavePaintedTheStone.mp3", Music.class); knifeDrop = assetManager.get("music/knifeDrop.mp3", Sound.class); }