當前位置: 首頁>>代碼示例>>Java>>正文


Java ParticleEffect.load方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.graphics.g2d.ParticleEffect.load方法的典型用法代碼示例。如果您正苦於以下問題:Java ParticleEffect.load方法的具體用法?Java ParticleEffect.load怎麽用?Java ParticleEffect.load使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.graphics.g2d.ParticleEffect的用法示例。


在下文中一共展示了ParticleEffect.load方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getParticleEffect

import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入方法依賴的package包/類
public static ParticleEffect getParticleEffect(ParticleEffectType particleEffectType, float positionX, float positionY){
    ParticleEffect effect = new ParticleEffect();
    effect.load(Gdx.files.internal(particleEffectType.getValue()), Gdx.files.internal(SFX_ROOT_DIR));
    effect.setPosition(positionX, positionY);
    switch(particleEffectType){
        case CANDLE_FIRE:
            effect.scaleEffect(1.6f);
            break;
        case LANTERN_FIRE:
            effect.scaleEffect(.6f);
            break;
        case LAVA_SMOKE:
            effect.scaleEffect(1.6f);
            break;
        case WAND_ATTACK:
            effect.scaleEffect(4.0f);
            break;
        default:
            break;
    }
    effect.start();
    return effect;
}
 
開發者ID:Mignet,項目名稱:Inspiration,代碼行數:24,代碼來源:ParticleEffectFactory.java

示例2: Car

import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入方法依賴的package包/類
public Car(String name, String lane, Texture texture, Vector2 pos, Vector2 direction) {

        super(texture, pos, direction);

        this.eType = 1;

        if(name.equals("CAR1")){
            carWidth = TextureManager.CAR1.getWidth();
            carHeight = TextureManager.CAR1.getHeight();
        }else if(name.equals("CAR2")){
            carWidth = TextureManager.CAR2.getWidth();
            carHeight = TextureManager.CAR2.getHeight();
        }


        smokeEffect = new ParticleEffect();
        smokeEffect.load(Gdx.files.internal("effects/car_smoke_1.p"), Gdx.files.internal("effect_img"));
        smokeEffect.setPosition(this.pos.x + carWidth / 2, this.pos.y + carHeight / 10 );
        smokeEffect.start();
    }
 
開發者ID:ilimturan,項目名稱:Crazy-Car-Race,代碼行數:21,代碼來源:Car.java

示例3: ParticleEffectPools

import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入方法依賴的package包/類
public ParticleEffectPools() {
	logger = new Logger(TAG, Env.debugLevel);
	
	logger.info("initialising");
	
	pools = new ObjectMap<String, ParticleEffectPool>();
	
	try {
		JsonReader reader = new JsonReader();
		JsonValue root = reader.parse(Gdx.files.internal(PARTICLES_FILE));
		JsonIterator particlesIt = root.iterator();
		
		while (particlesIt.hasNext()) {
			JsonValue particleValue = particlesIt.next();
			String effectName = particleValue.asString();
			logger.info("loading " + effectName);
			ParticleEffect effect = new ParticleEffect();
			effect.load(Gdx.files.internal(effectName), Gdx.files.internal(PARTICLES_FOLDER));
			
			pools.put(effectName, new ParticleEffectPool(effect,
								    					 Env.particlePoolInitialCapacity,
											 			 Env.particlePoolMaxCapacity));
		}
	}
	catch (Exception e) {
		logger.error("failed to list directory " + PARTICLES_FILE);
	}
}
 
開發者ID:saltares,項目名稱:sioncore,代碼行數:29,代碼來源:ParticleEffectPools.java

示例4: FireWorksLayer

import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入方法依賴的package包/類
public FireWorksLayer(GameGrid gameGrid) {
	super();

	gameGrid.events().register(this);
	TutorialEngine.instance().eventBus().register(this);
	AchievementEngine.instance().eventBus().register(this);

	ParticleEffect particleEffect = new ParticleEffect();
	particleEffect.load(Gdx.files.internal("particles/firework.p"), Gdx.files.internal("particles"));

	Set<float[]> colors = Sets.newHashSet();
	colors.add(makeParticleColorArray(Color.WHITE, Color.RED, Color.ORANGE));
	colors.add(makeParticleColorArray(Color.WHITE, Color.BLUE, Color.GREEN));
	colors.add(makeParticleColorArray(Color.WHITE, Color.YELLOW, Color.PINK));
	colors.add(makeParticleColorArray(Color.WHITE, Color.PINK, Color.MAGENTA));
	colors.add(makeParticleColorArray(Color.WHITE, Color.BLUE, Color.CYAN));

	colorsIterator = Iterators.cycle(colors);

	worldBounds = new Rectangle();
	for (int i = 0; i < 10; i++) {
		addChild(new ParticleEffectManager(new ParticleEffect(particleEffect), colorsIterator, worldBounds));
	}
}
 
開發者ID:frigidplanet,項目名稱:droidtowers,代碼行數:25,代碼來源:FireWorksLayer.java

示例5: PoisonDrop

import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入方法依賴的package包/類
public PoisonDrop(final CDGame game) {
	super(game);
	x = MathUtils.random(0, game.GAME_WIDTH-64);
	y = game.GAME_HEIGHT;
	width = 64;
	height = 64;
	loseOnMiss = false;
	gainValue = 0;
	loseValue = 2;
	rectImg = new Texture("poison.png");
	
	poisonTimer = 10;
	nowTimeInSeconds = TimeUtils.nanosToMillis(TimeUtils.nanoTime())/1000;
	lastTimeInSeconds = nowTimeInSeconds;
	
	fireEffect = new ParticleEffect();
	fireEffect.load(Gdx.files.internal("fire.p"), Gdx.files.internal(""));
	fireEffectPool = new ParticleEffectPool(fireEffect, 1, 2);
	firePEffect = fireEffectPool.obtain();
}
 
開發者ID:buzzbyte,項目名稱:CatchDROP,代碼行數:21,代碼來源:PoisonDrop.java

示例6: loadAssets

import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入方法依賴的package包/類
@Override
  public void loadAssets()
  {
      loader.parseLevel(world);
game.assets.manager.load("data/hud/hud.pack", TextureAtlas.class);
      game.assets.manager.load("data/hud/controls.pack", TextureAtlas.class);
      game.assets.manager.load("data/maryo/small.pack", TextureAtlas.class);
      game.assets.manager.load("data/game/logo/smc_big_1.png", Texture.class, game.assets.textureParameter);
      game.assets.manager.load("data/game/background/more_hills.png", Texture.class, game.assets.textureParameter);
      game.assets.manager.load("data/sounds/audio_on.mp3", Sound.class);
      cloudsPEffect = new ParticleEffect();
      cloudsPEffect.load(game.assets.resolver.resolve("data/animation/particles/clouds_emitter.p"), game.assets.resolver.resolve("data/clouds/default_1/"));
      cloudsPEffect.setPosition(Constants.MENU_CAMERA_WIDTH / 2, Constants.MENU_CAMERA_HEIGHT);
      cloudsPEffect.start();

      game.assets.manager.load("data/hud/lock.png", Texture.class, game.assets.textureParameter);
      exitDialog.loadAssets();
      settingsDialog.loadAssets();

  }
 
開發者ID:pedja1,項目名稱:SMC-Android,代碼行數:21,代碼來源:MainMenuScreen.java

示例7: addParticleEffect

import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入方法依賴的package包/類
/**
 * Add new (and activate) the effect just has been added.
 * @param key key of effect
 * @param particleEffectFilePath File path of effect file
 * @param dirPathOfImages path of folder that contains images for effect 
 * @param isActiveEffect set Active Effect for effect just has been added.
 */
public void addParticleEffect(String key, String particleEffectFilePath, String dirPathOfImages){
	
	if(collection.containsKey(key))
	{
		throw new GdxRuntimeException("Key for the particle effect is existing!");
	}
	
	ParticleEffect effect = new ParticleEffect();
	effect.load(Gdx.files.internal(particleEffectFilePath),Gdx.files.internal(dirPathOfImages));
	ParticleEffectPool pool =  new ParticleEffectPool(effect, 1, 2);
	collection.put(key, pool);
}
 
開發者ID:game-libgdx-unity,項目名稱:GDX-Engine,代碼行數:20,代碼來源:ParticleEffectManager.java

示例8: Particles

import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入方法依賴的package包/類
public Particles(TextureAtlas textureAtlas) {
    fireworkEffects = new ParticleEffectPool.PooledEffect[5];
    startColors = new float[][]{ //
            new float[]{0, .58f, 1}, // blue
            new float[]{1, .984f, .267f}, // yellow
            new float[]{.969f, .11f, 1}, // pink
            new float[]{1, .02f, .082f}, // red
            new float[]{.816f, 0, 1}, // violet
            new float[]{0, 1, .098f}, // green
    };

    ParticleEffect fireworksEffect = new ParticleEffect();
    fireworksEffect.load(Gdx.files.internal("particles/fireworks.p"), textureAtlas);

    // if particle effect includes additive or pre-multiplied particle emitters
    // you can turn off blend function clean-up to save a lot of draw calls
    // but remember to switch the Batch back to GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA
    // before drawing "regular" sprites or your Stage.
    fireworksEffect.setEmittersCleanUpBlendFunction(false);

    fireworksEffectPool = new ParticleEffectPool(fireworksEffect, 1, 5);
    for (int i = 0; i < fireworkEffects.length; i++) {
        ParticleEffectPool.PooledEffect effect = fireworksEffectPool.obtain();
        resetFireworksEffect(effect);
        fireworkEffects[i] = effect;
    }
}
 
開發者ID:cdetamble,項目名稱:jewelthief,代碼行數:28,代碼來源:Particles.java

示例9: load

import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入方法依賴的package包/類
public EscapyWeather load(String[] pFile, String[] pImg, String[] names) {

		for (int i = 0; i < pFile.length; i++) {

			ParticleEffect tmp = new ParticleEffect();
			tmp.load(new FileHandle(pFile[i]), new FileHandle(pImg[i]));
			tmp.setPosition(0, -50);
			weatherArray.addSource(new ParticleEffectPool(tmp, 0, 10), names[i]);
		}
		return this;
	}
 
開發者ID:henryco,項目名稱:Escapy,代碼行數:12,代碼來源:EscapyWeather.java

示例10: loadParticle

import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入方法依賴的package包/類
private Entity loadParticle(OverlapScene scene, JsonValue value) {
	Entity entity = new Entity();
	
	logger.info("loading particle: " + value.getString("particleName") + " " + value.getString("itemIdentifier", ""));
	
	NodeComponent node = new NodeComponent();
	TransformComponent transform = new TransformComponent();
	ParticleComponent particle = new ParticleComponent();
	ZIndexComponent index = new ZIndexComponent();
	SizeComponent size = new SizeComponent();
	IDComponent id = new IDComponent();
	
	id.value = value.getInt("uniqueId");
	
	loadTransform(transform, value);
	index.layer = value.getString("layerName");
	
	String particleName = value.getString("particleName");
	
	ParticleEffect effect = new ParticleEffect();
	effect.load(
		Gdx.files.internal(PARTICLES_DIR + particleName),
		atlas
	);
	
	particle.effect = effect;
	BoundingBox box = particle.effect.getBoundingBox(); 
	size.width = (box.max.x - box.min.x) * parameters.units;
	size.height = (box.max.y - box.min.y) * parameters.units;
	
	entity.add(node);
	entity.add(size);
	entity.add(transform);
	entity.add(particle);
	entity.add(index);
	entity.add(id);
	
	return entity;
}
 
開發者ID:saltares,項目名稱:libgdxjam,代碼行數:40,代碼來源:OverlapSceneLoader.java

示例11: EntityManager

import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入方法依賴的package包/類
public EntityManager() {
    /**
     * for create entities
     */
    speed = GameScreen.speed;
    screenHeight = Gdx.graphics.getHeight();
    screenWidth = Gdx.graphics.getWidth();
    entityHeight = TextureManager.COINGOLD.getHeight();
    entityWidthHalf = TextureManager.COINGOLD.getWidth() / 2;


    c1x = (1 * (screenWidth / 8)) - (TextureManager.CAR1.getWidth() / 2);
    c2x = (5 * (screenWidth / 8)) - (TextureManager.CAR2.getWidth() / 2);

    carOne = new CarOne(new Vector2(c1x, 20), new Vector2(0, 0));
    carTwo = new CarTwo(new Vector2(c2x, 20), new Vector2(0, 0));

    treesAndGolds = new Array<Entity>();

    scoreBoard = new ScoreBoard(new Vector2(screenWidth - (TextureManager.SCOREBOARD.getWidth() / 5 * 3), Gdx.graphics.getHeight() - (TextureManager.SCOREBOARD.getHeight() / 5 * 3)), new Vector2(0, 0));

    //Gold effects
    goldEffectFile = Gdx.files.internal("effects/get_golds_1.p");
    goldEffectImg = Gdx.files.internal("effect_img");
    goldEffect = new ParticleEffect();
    goldEffect.load(goldEffectFile, goldEffectImg);
    // Gold sound
    goldEffectSound = Gdx.files.internal("sounds/coin_gold_sound.mp3");
    coinGoldSound = Gdx.audio.newSound(goldEffectSound);


}
 
開發者ID:ilimturan,項目名稱:Crazy-Car-Race,代碼行數:33,代碼來源:EntityManager.java

示例12: load

import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入方法依賴的package包/類
@Override
public ParticleEffect load(AssetManager assetManager, String fileName, FileHandle file,
      ParticleParameter parameter) {
   final ParticleEffect effect = new ParticleEffect();
   effect.load(file, resolve(""));
   return effect;
}
 
開發者ID:bitbrain,項目名稱:braingdx,代碼行數:8,代碼來源:ParticleLoader.java

示例13: show

import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入方法依賴的package包/類
@Override
public void show() {
    batch = new SpriteBatch();
    logo = new Texture("udacity_logo_white.png");
    logoHeight = logo.getHeight() * LOGO_WIDTH / logo.getWidth();

    ParticleEffect touchEffect = new ParticleEffect();
    touchEffect.load(Gdx.files.internal("UdacityEmitter.p"), Gdx.files.internal(""));
    touchEffect.setEmittersCleanUpBlendFunction(false);
    touchEffectPool = new ParticleEffectPool(touchEffect, 1, 2);
    Gdx.input.setInputProcessor(this);
}
 
開發者ID:udacity,項目名稱:ud405,代碼行數:13,代碼來源:UdacityScreen.java

示例14: loadTemplates

import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入方法依賴的package包/類
public void loadTemplates () {
	for (int i = 0; i < ParticleType.values().length; i++) {
		ParticleEffect template = new ParticleEffect();
		template.load(Gdx.files.internal(ROOT_DIR + ParticleType.values()[i].file), Gdx.files.internal(ROOT_DIR));
		template.scaleEffect(0.02f);
		effectTemplates.add(template);

		ParticleEffectPool pool = new ParticleEffectPool(template, 4, 20);
		effectPools.add(pool);
	}
}
 
開發者ID:libgdx-jam,項目名稱:GDXJam,代碼行數:12,代碼來源:ParticleSystem.java

示例15: Particle

import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入方法依賴的package包/類
public Particle(String particleFileString, float x, float y) {
    particleEffect = new ParticleEffect();
    particleEffect.load(Gdx.files.internal(particleFileString), Gdx.files.internal("particles"));
    particleEffect.setPosition(x, y);
    particleEffect.scaleEffect(1 / GameManager.PPM);
    particleEffect.start();
}
 
開發者ID:yichen0831,項目名稱:Bomberman_libGdx,代碼行數:8,代碼來源:Particle.java


注:本文中的com.badlogic.gdx.graphics.g2d.ParticleEffect.load方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。