本文整理汇总了Java中com.badlogic.gdx.graphics.g2d.ParticleEffect.start方法的典型用法代码示例。如果您正苦于以下问题:Java ParticleEffect.start方法的具体用法?Java ParticleEffect.start怎么用?Java ParticleEffect.start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.graphics.g2d.ParticleEffect
的用法示例。
在下文中一共展示了ParticleEffect.start方法的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;
}
示例2: 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;
}
示例3: 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();
}
示例4: 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;
}
示例5: 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;
}
示例6: 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);
}
示例7: 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();
}
示例8: onCreateColor
import com.badlogic.gdx.graphics.g2d.ParticleEffect; //导入方法依赖的package包/类
@Override
public void onCreateColor(Monster monster, MonsterColor color) {
ParticleEffect effect = manager.create(Assets.getInstance().get(Assets.FLARE, ParticleEffect.class), false);
Maze maze = monster.getMaze();
float x = color.getX() * maze.getBlockSize() + maze.getX() + maze.getBlockSize() / 2;
float y = color.getY() * maze.getBlockSize() + maze.getY() + maze.getBlockSize() / 2;
effect.setPosition(x, y);
manager.setColor(effect, new float[]{color.r, color.g, color.b}, new float[]{0f});
effect.start();
for (ParticleEmitter e : effect.getEmitters()) {
e.getScale().setLow(Gdx.graphics.getWidth() / 100f);
e.getDuration().setLow(Monster.LENGTH * StupidMonsterLogic.INTERVAL);
e.getLife().setLow(Monster.LENGTH * StupidMonsterLogic.INTERVAL);
e.getDuration().setLowMin(Monster.LENGTH * StupidMonsterLogic.INTERVAL);
e.getLife().setLowMin(Monster.LENGTH * StupidMonsterLogic.INTERVAL);
e.getVelocity().setLow(Gdx.graphics.getWidth() / 300f);
}
effects.put(color, effect);
}
示例9: onRemoveTrailColor
import com.badlogic.gdx.graphics.g2d.ParticleEffect; //导入方法依赖的package包/类
@Override
public void onRemoveTrailColor(MonsterColor color) {
Maze maze = color.getMonster().getMaze();
ParticleEffect effect = manager.create(Assets.getInstance().get(Assets.FLARE, ParticleEffect.class), false);
float x = color.getX() * maze.getBlockSize() + maze.getX() + maze.getBlockSize() / 2;
float y = color.getY() * maze.getBlockSize() + maze.getY() + maze.getBlockSize() / 2;
effect.setPosition(x, y);
manager.setColor(effect, new float[]{color.r, color.g, color.b}, new float[]{0f});
effect.start();
for (ParticleEmitter e : effect.getEmitters()) {
e.getScale().setLow(Gdx.graphics.getWidth() / 30f);
e.getDuration().setLow(Monster.LENGTH * StupidMonsterLogic.INTERVAL / 104);
e.getLife().setLow(Monster.LENGTH * StupidMonsterLogic.INTERVAL / 140);
e.getDuration().setLowMin(Monster.LENGTH * StupidMonsterLogic.INTERVAL / 140);
e.getLife().setLowMin(Monster.LENGTH * StupidMonsterLogic.INTERVAL / 140);
e.getVelocity().setLow(Gdx.graphics.getWidth() / 50f);
}
effects.put(color, effect);
Gdx.input.vibrate(20);
}
示例10: Fire
import com.badlogic.gdx.graphics.g2d.ParticleEffect; //导入方法依赖的package包/类
public Fire(GameObject shooter, float xTarget, float yTarget, ParticleEffect shoot) {
super("yellow_shoot", 0, 0, shooter,null,null,null);
if (!this.isFromShootOfEnemy()) {
this.setX((int)(shooter.getX()+shooter.getWidth()+this.getHeight()));
} else {
this.setX((int) shooter.getX());
}
this.setY(getShooter().getY() + this.getHeight());
this.setOrigin(0,this.getHeight()/2);
FULL_WIDTH = getWidth();
actualReasonOfScaling = 0.0f;
this.shoot = shoot;
shoot.getEmitters().first().setPosition(this.getX() - this.getHeight()/2, this.getY()+this.getHeight()/2);
vector = new Vector2();
//Si es la nave el shooter, o bien el shooter del shoot que ejecutó el fuego, usamos el touchManager
if (!this.isFromShootOfEnemy()) {
targetVector = TouchManager.getTouchFromPosition(xTarget, yTarget);
} else {
targetVector = new Vector3();
targetVector.x = xTarget;
targetVector.y = yTarget;
}
recalculateLifeShootEffect();
shoot.start();
}
示例11: ParticleEffectActuator
import com.badlogic.gdx.graphics.g2d.ParticleEffect; //导入方法依赖的package包/类
public ParticleEffectActuator(ParticleEffect effect, boolean autoStart, float locaPosX, float locaPosY) {
this.particleEffect = effect;
this.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();
};
}
示例12: 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();
}
示例13: Fireball
import com.badlogic.gdx.graphics.g2d.ParticleEffect; //导入方法依赖的package包/类
public Fireball(World world, float x, float y, float width) {
super(null, new CircleShape(), world, x, y, width);
this.lifeSpan = 3000;
effect = new ParticleEffect();
effect.load(Gdx.files.internal("fire.p"), Assets.getAtlas());
effect.scaleEffect(width);
effect.setDuration((int) (lifeSpan - 1000));
effect.start();
}
示例14: ParticleStatus
import com.badlogic.gdx.graphics.g2d.ParticleEffect; //导入方法依赖的package包/类
public ParticleStatus(Actor owner, long time, String name, ParticleEffect particleEffect) {
super(owner, time, name);
this.particleEffect = particleEffect;
particleEffect.setDuration((int) time - 1000);
particleEffect.scaleEffect(owner.getWidth() * owner.getHeight() / 4);
particleEffect.start();
}
示例15: onAssetsLoaded
import com.badlogic.gdx.graphics.g2d.ParticleEffect; //导入方法依赖的package包/类
@Override
public void onAssetsLoaded()
{
hud.initAssets();
world.level = loader.level;
audioOn = game.assets.manager.get("data/sounds/audio_on.mp3", Sound.class);
exitDialog.initAssets();
debugFont = game.assets.manager.get("debug.ttf");
debugFont.setColor(1, 0, 0, 1);
debugObjectFont = game.assets.manager.get("debug_object.ttf");
debugGlyph = new GlyphLayout();
for (GameObject go : loader.level.gameObjects)
{
go.initAssets();
}
BitmapFont pointsFont = game.assets.manager.get("kill-points.ttf");
pointsFont.setColor(1, 1, 1, 1);
killPointsTextHandler = new KillPointsTextHandler(pointsFont);
for(Background background : world.level.backgrounds)
{
background.onAssetsLoaded(cam, game.assets);
}
if(!TextUtils.isEmpty(world.level.particleEffect))
{
globalEffect = new ParticleEffect(game.assets.manager.get(world.level.particleEffect, ParticleEffect.class));
globalEffect.start();
}
}