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


Java ParticleEffect類代碼示例

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


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

示例1: loadParticleEffects

import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入依賴的package包/類
private void loadParticleEffects(TiledMap data, String atlasname) {
	MapObjects objects = data.getLayers().get("preload").getObjects();
	String ppcheck = "Particle";
	for (MapObject o : objects) {
		String name = o.getName();
		MapProperties properties = o.getProperties();
		String type = properties.get("type", String.class);
		if (type != null && type.equals(ppcheck)) {
			String file = properties.get("particle_file", String.class);
			if (file != null) {
				game.loadParticleEffect(file, atlasname);
				game.getAssetManager().finishLoading();
				if (!particle_effects.containsKey(name)) {
					ParticleEffect pe = game.getParticleEffect(file);
					pe.setEmittersCleanUpBlendFunction(false);
					pvalues.add(KyperBoxGame.PARTICLE_FOLDER + KyperBoxGame.FILE_SEPARATOR + file);
					particle_effects.put(name, new ParticleEffectPool(pe, 12, 48));
				}
			}
		}
	}
}
 
開發者ID:kyperbelt,項目名稱:KyperBox,代碼行數:23,代碼來源:GameState.java

示例2: act

import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入依賴的package包/類
@Override
public void act(float delta){
    battleTimer = (battleTimer + delta)%60;
    if( damageValLabel.isVisible() && damageValLabel.getY() < this.getHeight()){
        damageValLabel.setY(damageValLabel.getY()+5);
    }

    if( battleShakeCam != null && battleShakeCam.isCameraShaking() ){
        Vector2 shakeCoords = battleShakeCam.getNewShakePosition();
        _image.setPosition(shakeCoords.x, shakeCoords.y);
    }

    for( int i = 0; i < _effects.size; i++){
        ParticleEffect effect = _effects.get(i);
        if( effect == null ) continue;
        if( effect.isComplete() ){
            _effects.removeIndex(i);
            effect.dispose();
        }else{
            effect.update(delta);
        }
    }

    super.act(delta);
}
 
開發者ID:Mignet,項目名稱:Inspiration,代碼行數:26,代碼來源:BattleUI.java

示例3: 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

示例4: Shoot

import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入依賴的package包/類
public Shoot(String nameTexture, int x, int y, GameObject shooter, ParticleEffect shootEffect, ParticleEffect destroyEffect, String shootFX) {
    super(nameTexture,x,y);
    this.shooter = shooter;
    shocked = false;

    originalShootPosition = new Vector2(x,y);

    //Creamos los efectos de partículas si no vienen nulos
    if (shootEffect != null) {
        this.shootEffect = shootEffect;
        shootEffect.start();
    }
    if (destroyEffect != null) {
        this.destroyEffect = destroyEffect;
        destroyEffect.start();
    }

    this.shootFX = shootFX;
}
 
開發者ID:SpaceGame-ETSII,項目名稱:spacegame,代碼行數:20,代碼來源:Shoot.java

示例5: Enemy

import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入依賴的package包/類
public Enemy(String textureName, int x, int y, int vitality, ParticleEffect destroyEffect) {
    super(textureName, x, y);
    initialPosition = new Vector2(x,y);
    this.vitality = vitality;
    deletable = false;
    this.destroyEffect = destroyEffect;
    timeToFlick = 0;
    timeForInvisible = RANGE_INVISIBLE_TIMER;

    targettedByShip = false;

    if(this.destroyEffect != null){
        this.destroyEffect.getEmitters().first().setPosition(this.getX() + this.getWidth()/2, this.getY() + this.getHeight()/2);
        this.destroyEffect.start();
    }
}
 
開發者ID:SpaceGame-ETSII,項目名稱:spacegame,代碼行數:17,代碼來源:Enemy.java

示例6: 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

示例7: addParticleEffectActuator

import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入依賴的package包/類
public ActuatorEntity addParticleEffectActuator(ParticleEffect effect,
		boolean autoStart, float locaPosX, float locaPosY) {
	ParticleEffectActuator component = (ParticleEffectActuator) recoverComponent(ActuatorComponentsLookup.ParticleEffectActuator);
	if (component == null) {
		component = new ParticleEffectActuator(effect, autoStart, locaPosX,
				locaPosY);
	} else {
		component.particleEffect = effect;
		component.actuator = (indexOwner) -> {
			GameEntity owner = Indexed.getInteractiveEntity(indexOwner);
			RigidBody rc = owner.getRigidBody();
			Transform transform = rc.body.getTransform();
			effect.setPosition(transform.getPosition().x + locaPosX,
					transform.getPosition().y + locaPosY);
			effect.update(Gdx.graphics.getDeltaTime());
			if (autoStart && effect.isComplete())
				effect.start();
		};
	}
	addComponent(ActuatorComponentsLookup.ParticleEffectActuator, component);
	return this;
}
 
開發者ID:Rubentxu,項目名稱:Entitas-Java,代碼行數:23,代碼來源:ActuatorEntity.java

示例8: replaceParticleEffectActuator

import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入依賴的package包/類
public ActuatorEntity replaceParticleEffectActuator(ParticleEffect effect,
		boolean autoStart, float locaPosX, float locaPosY) {
	ParticleEffectActuator component = (ParticleEffectActuator) recoverComponent(ActuatorComponentsLookup.ParticleEffectActuator);
	if (component == null) {
		component = new ParticleEffectActuator(effect, autoStart, locaPosX,
				locaPosY);
	} else {
		component.particleEffect = effect;
		component.actuator = (indexOwner) -> {
			GameEntity owner = Indexed.getInteractiveEntity(indexOwner);
			RigidBody rc = owner.getRigidBody();
			Transform transform = rc.body.getTransform();
			effect.setPosition(transform.getPosition().x + locaPosX,
					transform.getPosition().y + locaPosY);
			effect.update(Gdx.graphics.getDeltaTime());
			if (autoStart && effect.isComplete())
				effect.start();
		};
	}
	replaceComponent(ActuatorComponentsLookup.ParticleEffectActuator,
			component);
	return this;
}
 
開發者ID:Rubentxu,項目名稱:Entitas-Java,代碼行數:24,代碼來源:ActuatorEntity.java

示例9: addEffect

import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入依賴的package包/類
public void addEffect(String name, Vector2 position, float angle){
	logger.debug("Creating effect: " + name);
	ParticleEffect effect = App.assets.getEffect(name);
	if (effect == null) {
		logger.error("Couldn't create particle effect: " + name);
		return;
	}
	ParticleEffect e = new ParticleEffect(effect);
	for (ParticleEmitter emitter : e.getEmitters()){
		float a1 = emitter.getAngle().getHighMin(),
			  a2 = emitter.getAngle().getHighMax();
		
		emitter.getRotation().setHighMin(a1 + angle);
		emitter.getRotation().setHighMax(a2 + angle);
	}
	e.setPosition(position.x * App.engine.PIXELS_PER_METER, position.y * App.engine.PIXELS_PER_METER);
	e.start();
	effects.add(e);
	
}
 
開發者ID:Deftwun,項目名稱:ZombieCopter,代碼行數:21,代碼來源:ParticleSystem.java

示例10: getOrLoad

import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入依賴的package包/類
@Override
public ParticleEffect getOrLoad(final String id) {
    final String[] data = Strings.split(id, '$');
    if (data.length == 0) {
        throwUnknownPathException();
    }
    final String path = determinePath(data[0]);
    getIdsToPaths().put(id, path);
    final AssetManager assetManager = getAssetManager();
    if (assetManager.isLoaded(path)) {
        return assetManager.get(path, getType());
    }
    if (data.length > 1) {
        final String atlasName = TextureAtlasProvider.getTextureAtlasPath(data[1]);
        final ParticleEffectParameter parameters = new ParticleEffectParameter();
        parameters.atlasFile = atlasName;
        assetManager.load(path, ParticleEffect.class, parameters);
    } else {
        assetManager.load(path, ParticleEffect.class);
    }
    return null;
}
 
開發者ID:czyzby,項目名稱:gdx-lml,代碼行數:23,代碼來源:ParticleEffectProvider.java

示例11: 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

示例12: AssetManager

import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入依賴的package包/類
/** Creates a new AssetManager with all default loaders. */
public AssetManager (FileHandleResolver resolver) {
	setLoader(BitmapFont.class, new BitmapFontLoader(resolver));
	setLoader(Music.class, new MusicLoader(resolver));
	setLoader(Pixmap.class, new PixmapLoader(resolver));
	setLoader(Sound.class, new SoundLoader(resolver));
	setLoader(TextureAtlas.class, new TextureAtlasLoader(resolver));
	setLoader(Texture.class, new TextureLoader(resolver));
	setLoader(Skin.class, new SkinLoader(resolver));
	setLoader(ParticleEffect.class, new ParticleEffectLoader(resolver));
	setLoader(PolygonRegion.class, new PolygonRegionLoader(resolver));
	setLoader(I18NBundle.class, new I18NBundleLoader(resolver));
	setLoader(Model.class, ".g3dj", new G3dModelLoader(new JsonReader(), resolver));
	setLoader(Model.class, ".g3db", new G3dModelLoader(new UBJsonReader(), resolver));
	setLoader(Model.class, ".obj", new ObjLoader(resolver));
	executor = new AsyncExecutor(1);
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:18,代碼來源:AssetManager.java

示例13: 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

示例14: match

import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入依賴的package包/類
@Override
public boolean match(FileHandle file) {
	boolean result = file.extension().equals("p");
	if(result) {
		Engine.getAssetManager().load(file.path().replace("\\", "/"),ParticleEffect.class);
		return result;
	}
	result = file.extension().equals("pp");
	if(result) {
		ParticleEffectParameter parameter = new ParticleEffectParameter();
		parameter.atlasFile = file.pathWithoutExtension().replace("\\", "/")+".atlas";
		Engine.getAssetManager().load(file.path().replace("\\", "/"),ParticleEffect.class,parameter);
		return result;
	}
	return  false;
}
 
開發者ID:lycying,項目名稱:c2d-engine,代碼行數:17,代碼來源:RuleParticleEffect.java

示例15: AchievementButton

import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入依賴的package包/類
public AchievementButton(TextureAtlas hudAtlas, AchievementEngine achievementEngine) {
	super(hudAtlas.findRegion("achievements"), Colors.ICS_BLUE);

	activeAnimation = new Animation(ANIMATION_DURATION, hudAtlas.findRegions("achievements-active"));
	nextAnimationTime = 0;

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

	addListener(new VibrateClickListener() {
		public void onClick(InputEvent event, float x, float y) {
			new AchievementListView(getStage()).show();
		}
	});

	setVisible(false);
}
 
開發者ID:frigidplanet,項目名稱:droidtowers,代碼行數:18,代碼來源:AchievementButton.java


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