当前位置: 首页>>代码示例>>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;未经允许,请勿转载。