public static void buildingDamaged(float x, float y, float gain) { int bash = Util.random(0, NUM_BASHES - 1); float pitch = (float) Math.random() / 20.0f; Game.allocateSound( instance.bashDistantBuffer[bash], Worm.calcGain(x, y) * gain, 1.0f - pitch, Game.class); Game.allocateSound( instance.bashBuffer[bash], Worm.calcGain(x, y) * gain, 1.0f - pitch, Game.class); }
public static void buildingDestroyed(float x, float y, float gain) { int bash = Util.random(0, NUM_BUILDING_DESTROYED - 1); Game.allocateSound( instance.buildingDestroyedDistantBuffer[bash], Worm.calcGain(x, y) * gain, 1.0f, Game.class); Game.allocateSound( instance.buildingDestroyedBuffer[bash], Worm.calcGain(x, y) * gain, 1.0f, Game.class); }
public static SoundEffect medalAwarded() { return Game.allocateSound(instance.medalAwardedBuffer); }
public static SoundEffect baseDestructionImminent() { return Game.allocateSound(instance.baseDestructionImminentBuffer); }
public static void baseAttacked() { Game.allocateSound(instance.baseAttackedBuffer); }
public static void factoryShutdown() { Game.allocateSound(instance.factoryShutdownBuffer); }
public static void insufficientFunds() { Game.allocateSound(instance.insufficientFundsBuffer); }
public static SoundEffect smartbomb() { return Game.allocateSound(instance.smartbombBuffer); }
public static void pickup() { Game.allocateSound(instance.pickupBuffer); }
public static void noAmmo() { Game.allocateSound(instance.noAmmoBuffer); }
public static void reloaded() { Game.allocateSound(instance.reloadedBuffer); }
public static void crystalSpawned(float x, float y) { Game.allocateSound(instance.crystalSpawnedBuffer, Worm.calcLoudGain(x, y), 1.0f, Game.class); }
public static void blastMineReady(float x, float y) { Game.allocateSound(instance.blastMineReadyBuffer, Worm.calcGain(x, y), 1.0f, Game.class); }
public static void ricochet(float x, float y, float gain) { int ric = Util.random(0, NUM_RICOCHETS - 1); Game.allocateSound(instance.ricochetBuffer[ric], Worm.calcGain(x, y) * gain, 1.0f, Game.class); }
public static SoundEffect achievementUnlocked() { return Game.allocateSound(instance.achievementUnlockedBuffer); }
public static void repair(float x, float y) { Game.allocateSound(instance.repairBuffer, Worm.calcGain(x, y), 1.0f, Game.class); }
public static SoundEffect newRank() { return Game.allocateSound(instance.newRankBuffer); }
public static void cantBuild() { Game.allocateSound(instance.cantBuildBuffer); }
public static void build() { Game.allocateSound(instance.buildBuffer); }
/* * (non-Javadoc) * @see net.puppygames.applet.Tickable#update() */ @Override public final void update() { calculateScreenPosition(); if (sprite != null) { // Firstly, if we're significantly offscreen, hide all the sprites. if (getScreenX() < -48.0f || getScreenX() >= Game.getWidth() + 48 || getScreenY() < -48.0f - getZ() || getScreenY() >= Game.getHeight() + 48 + getZ()) { for (Sprite element : sprite) { element.setVisible(false); } doUpdate(); return; } else { for (Sprite element : sprite) { element.setVisible(visible); } } boolean searchForChildOffsets = false; for (Sprite element : sprite) { element.setLocation(screenX, screenY, 0); if (element.getLayer() > Layers.SHADOW) { element.setFlash(flash); } // shall we bother checking anims for childOffset stuff? if (element.isDoChildOffset()) { searchForChildOffsets = true; } } if (searchForChildOffsets) { float xOffset = 0; float yOffset = 0; yOffsetTotal = 0; xOffsetTotal = 0; for (int i = 0; i < sprite.length; i++) { boolean doOffset = false; // check for offset if (sprite[i].getChildXOffset() != 0) { xOffset = sprite[i].getChildXOffset(); xOffset *= FPMath.floatValue(sprite[0].getXScale()); if (isMirrored() && xOffset != 0) { // chaz hack! - if we've got any <offset anim commands they'd need to be mirrored too // so for now will disable mirroring of childOffset if <offset x=""/> present if (sprite[i].getOffset(null).x == 0) { xOffset = -xOffset; } } xOffsetTotal += xOffset; doOffset = true; } if (sprite[i].getChildYOffset() != 0) { yOffset = sprite[i].getChildYOffset(); yOffset *= FPMath.floatValue(sprite[0].getYScale()); yOffsetTotal += yOffset; doOffset = true; } // if we've found an offset apply this to any sprites after where we found the offset if (doOffset) { for (int j = i + 1; j < sprite.length; j++) { if (sprite[j].isDoChildOffset()) { sprite[j].setLocation(screenX + xOffsetTotal, screenY + yOffsetTotal, 0); sprite[j].setYSortOffset( -yOffsetTotal - j); // the '-j' is chaz hack! budge layers YSortOffset a tad to force // render ok } } } } } LayersFeature currentAppearance = getCurrentAppearance(); float cx = getMapX() + getCollisionX(); float cy = getMapY() + getCollisionY(); if (currentAppearance != null && (GameScreen.isDiddlerOpen() || hackyTick > 0 || cx != oldX || cy != oldY || currentAppearance != oldAppearance)) { currentAppearance.updateColors(sprite, cx, cy); if (hackyTick > 0) { hackyTick--; } } oldX = cx; oldY = cy; oldAppearance = currentAppearance; } doUpdate(); }