本文整理匯總了Java中com.badlogic.gdx.graphics.g2d.ParticleEffect.setPosition方法的典型用法代碼示例。如果您正苦於以下問題:Java ParticleEffect.setPosition方法的具體用法?Java ParticleEffect.setPosition怎麽用?Java ParticleEffect.setPosition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.graphics.g2d.ParticleEffect
的用法示例。
在下文中一共展示了ParticleEffect.setPosition方法的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: 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();
}
示例3: 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;
}
示例4: 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;
}
示例5: 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);
}
示例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();
}
示例7: onMove
import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入方法依賴的package包/類
@Override
public void onMove(GameObject object) {
ParticleEffect effect = effects.get(object);
Integer count = particleCounts.get(object);
if (effect != null) {
if (object.isIced()) {
if (particleManager.getParticleCount(effect) == count) {
particleManager.setParticleCount(effect, count / 20);
}
} else {
if (particleManager.getParticleCount(effect) != count) {
particleManager.setParticleCount(effect, count);
}
}
if (object.getType().equals(GameObjectType.ALIEN)) {
effect.setPosition(object.getCenterX(), object.getCenterY() + object.getHeight() / 3f);
} else {
effect.setPosition(object.getCenterX(), object.getCenterY());
}
}
}
示例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: resetFireworksEffect
import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入方法依賴的package包/類
/**
* Resets the position, start color and duration of the given firework effects to random values.
*
* @param effect
*/
private void resetFireworksEffect(ParticleEffect effect) {
effect.reset();
effect.setDuration(Utils.randomWithin(180, 250));
effect.setPosition(Utils.randomWithin(0, WINDOW_WIDTH), Utils.randomWithin(0, WINDOW_HEIGHT));
float[] colors = effect.getEmitters().get(0).getTint().getColors();
int randomStartColor = Utils.randomWithin(0, startColors.length - 1);
for (int i = 0; i < 6; i++) {
colors[i] = startColors[randomStartColor][i % 3];
}
for (ParticleEmitter emitter : effect.getEmitters()) {
emitter.getTint().setColors(colors);
}
}
示例11: 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;
}
示例12: 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();
};
}
示例13: 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();
}
示例14: popOutFromBox
import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入方法依賴的package包/類
@Override
public void popOutFromBox(float popTargetPosY)
{
super.popOutFromBox(popTargetPosY);
visible = true;
popFromBox = true;
velocity.y = VELOCITY_POP;
originalPosY = position.y;
ParticleEffect effect = world.screen.game.assets.manager.get("data/animation/particles/fireplant_emitter.p", ParticleEffect.class);
effect.setPosition(position.x + mDrawRect.width / 2, position.y + mDrawRect.height / 2);
effect.start();
}
示例15: _render
import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入方法依賴的package包/類
@Override
public void _render(SpriteBatch spriteBatch)
{
if(!visible)return;
TextureRegion frame = animation.getKeyFrame(stateTime, true);
Utility.draw(spriteBatch, frame, position.x, position.y, mDrawRect.height);
ParticleEffect effect = world.screen.game.assets.manager.get("data/animation/particles/fireplant_emitter.p", ParticleEffect.class);
effect.setPosition(position.x + mDrawRect.width / 2, position.y + mDrawRect.height / 2);
effect.draw(spriteBatch, Gdx.graphics.getDeltaTime());
}