当前位置: 首页>>代码示例>>Java>>正文


Java ParticleEmitter.setPosition方法代码示例

本文整理汇总了Java中com.badlogic.gdx.graphics.g2d.ParticleEmitter.setPosition方法的典型用法代码示例。如果您正苦于以下问题:Java ParticleEmitter.setPosition方法的具体用法?Java ParticleEmitter.setPosition怎么用?Java ParticleEmitter.setPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.graphics.g2d.ParticleEmitter的用法示例。


在下文中一共展示了ParticleEmitter.setPosition方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addEmitter

import com.badlogic.gdx.graphics.g2d.ParticleEmitter; //导入方法依赖的package包/类
private void addEmitter (String name, boolean select, final ParticleEmitter emitter) {
	Array<ParticleEmitter> emitters = editor.effect.getEmitters();
	if (emitters.size == 0)
		emitter.setPosition(editor.worldCamera.viewportWidth / 2, editor.worldCamera.viewportHeight / 2);
	else {
		ParticleEmitter p = emitters.get(0);
		emitter.setPosition(p.getX(), p.getY());
	}
	emitters.add(emitter);

	emitterTableModel.addRow(new Object[] {name, true});
	if (select) {
		editor.reloadRows();
		int row = emitterTableModel.getRowCount() - 1;
		emitterTable.getSelectionModel().setSelectionInterval(row, row);
	}
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:18,代码来源:EffectPanel.java

示例2: addParticle

import com.badlogic.gdx.graphics.g2d.ParticleEmitter; //导入方法依赖的package包/类
/**
 * Adds a ParticleEffect from a ParticleEffectVO. Uses ParticleEmitterBox2D
 * @param item ParticleEffectVO to add
 */
private static void addParticle(ParticleEffectVO item) {
    ParticleEffect particleEffect = new ParticleEffect();
    particleEffect.load(Gdx.files.internal(particlesPath + "/" + item.particleName), atlas);
    particleEffect.scaleEffect(ZeroBit.pixelsToMeters * item.scaleX);

    for (int i=0; i < particleEffect.getEmitters().size; i++) {
        particleEffect.getEmitters().set(i, new ParticleEmitterBox2D(b2dSystem.getB2World(), particleEffect.getEmitters().get(i)));
        ParticleEmitter emitter = particleEffect.getEmitters().get(i);

        // Spawn scaling doesn't seem to alter the actual dimensions of the effect like in the editor
        /*emitter.getSpawnWidth().setHigh(emitter.getSpawnWidth().getHighMin() * item.scaleX, emitter.getSpawnWidth().getHighMax() * item.scaleX);
        emitter.getSpawnWidth().setLow(emitter.getSpawnWidth().getLowMin() * item.scaleX, emitter.getSpawnWidth().getLowMax() * item.scaleX);
        emitter.getSpawnHeight().setHigh(emitter.getSpawnHeight().getHighMin() * item.scaleY, emitter.getSpawnHeight().getHighMax() * item.scaleY);
        emitter.getSpawnHeight().setLow(emitter.getSpawnHeight().getLowMin() * item.scaleY, emitter.getSpawnHeight().getLowMax() * item.scaleY);*/

        emitter.setPosition(item.x * ZeroBit.pixelsToMeters, item.y * ZeroBit.pixelsToMeters);
    }
    //entityManager.getEngine().getSystem(RenderingSystem.class).addParticle(particleEffect);
    ParticleComponent pc = new ParticleComponent();
    pc.addParticle(particleEffect);
    addEntity(item, null, pc, new VisualComponent());
}
 
开发者ID:ALPSquid,项目名称:0Bit-Engine,代码行数:27,代码来源:Overlap2DLoader.java

示例3: Engine

import com.badlogic.gdx.graphics.g2d.ParticleEmitter; //导入方法依赖的package包/类
public Engine(boolean fallIn, float toX) {
	super(fallIn, toX);
	
	sprite = new Sprite(Game.gfxMgr.getTexture("test", "engine.png"));
	sprite.setOrigin(sprite.getWidth() / 2f, sprite.getHeight() / 2);
	
	emit = new ParticleEmitter(Game.gfxMgr.getParticleEffect("test", "boss.p").getEmitters().get(0));
	emit.setPosition(this.x, this.y);
	
	laser = null;
	chargingMyLaser = false;
	
	this.bound = new Circle(this.x, this.y, 8);
}
 
开发者ID:pixelgriffin,项目名称:SPACEJUNK,代码行数:15,代码来源:Engine.java

示例4: openEffect

import com.badlogic.gdx.graphics.g2d.ParticleEmitter; //导入方法依赖的package包/类
void openEffect () {
	FileDialog dialog = new FileDialog(editor, "Open Effect", FileDialog.LOAD);
	if (lastDir != null) dialog.setDirectory(lastDir);
	dialog.setVisible(true);
	final String file = dialog.getFile();
	final String dir = dialog.getDirectory();
	if (dir == null || file == null || file.trim().length() == 0) return;
	lastDir = dir;
	ParticleEffect effect = new ParticleEffect();
	try {
		effect.loadEmitters(Gdx.files.absolute(new File(dir, file).getAbsolutePath()));
		editor.effect = effect;
		emitterTableModel.getDataVector().removeAllElements();
		editor.particleData.clear();
	} catch (Exception ex) {
		System.out.println("Error loading effect: " + new File(dir, file).getAbsolutePath());
		ex.printStackTrace();
		JOptionPane.showMessageDialog(editor, "Error opening effect.");
		return;
	}
	for (ParticleEmitter emitter : effect.getEmitters()) {
		emitter.setPosition(editor.worldCamera.viewportWidth / 2, editor.worldCamera.viewportHeight / 2);
		emitterTableModel.addRow(new Object[] {emitter.getName(), true});
	}
	editIndex = 0;
	emitterTable.getSelectionModel().setSelectionInterval(editIndex, editIndex);
	editor.reloadRows();
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:29,代码来源:EffectPanel.java

示例5: openEffect

import com.badlogic.gdx.graphics.g2d.ParticleEmitter; //导入方法依赖的package包/类
void openEffect () {
	FileDialog dialog = new FileDialog((Frame) null, "Open Effect", FileDialog.LOAD);
	if (lastDir != null) dialog.setDirectory(lastDir);
	dialog.setVisible(true);
	final String file = dialog.getFile();
	final String dir = dialog.getDirectory();
	if (dir == null || file == null || file.trim().length() == 0) return;
	lastDir = dir;
	ParticleEffect effect = new ParticleEffect();
	try {
		effect.loadEmitters(Gdx.files.absolute(new File(dir, file).getAbsolutePath()));
		editor.effect = effect;
		emitterTableModel.getDataVector().removeAllElements();
		editor.particleData.clear();
	} catch (Exception ex) {
		System.out.println("Error loading effect: " + new File(dir, file).getAbsolutePath());
		ex.printStackTrace();
		JOptionPane.showMessageDialog(editor, "Error opening effect.");
		return;
	}
	for (ParticleEmitter emitter : effect.getEmitters()) {
		emitter.setPosition(editor.worldCamera.viewportWidth / 2, editor.worldCamera.viewportHeight / 2);
		emitterTableModel.addRow(new Object[] {emitter.getName(), true});
	}
	editIndex = 0;
	emitterTable.getSelectionModel().setSelectionInterval(editIndex, editIndex);
	editor.reloadRows();
}
 
开发者ID:pyros2097,项目名称:GdxStudio,代码行数:29,代码来源:EffectPanel.java

示例6: show

import com.badlogic.gdx.graphics.g2d.ParticleEmitter; //导入方法依赖的package包/类
@Override
public void show() {
	//create UI
	ui = new Stage();
	Gdx.input.setInputProcessor(ui);
	
	//get basic data
	cam = Game.gfxMgr.getCamera();
	batch = Game.gfxMgr.getBatch();
	
	fadeSpriteBack = new Sprite(Game.gfxMgr.getTexture("test", "black.png"));
	fadeSpriteBack.setScale(1920, 1280);
	fadeSpriteBack.setAlpha(0);
	
	fadeSpriteFront = new Sprite(Game.gfxMgr.getTexture("test", "black.png"));
	fadeSpriteFront.setScale(1920, 1280);
	fadeSpriteFront.setAlpha(0);
	
	//create a flash timer
	flashTime = 1.0f;
	
	//set up final boss statistics
	bossTime = false;
	bigBossDown = false;
	bossGoodbye = false;
	
	bossPop = 0.0f;
	
	bossEntrance = null;
	
	bossEndX = null;
	bossEndY = null;
	
	//create earth
	enterTween = Game.twnMgr.createTween(BackTween.class, TweenType.OUT, -32, 100, 2);
	earth = Game.gfxMgr.getTexture("test", "world.png");
	
	//gather generated player
	boss = Game.entMgr.core;
	boss.setX(480);
	boss.setY(450);
	
	Game.entMgr.addEntity(boss);
	for(Part p : boss.parts) {
		Game.entMgr.addEntity(p);
	}
	
	//shake upon entrance
	cam.shake();
	
	//start stars
	emit = new ParticleEmitter(Game.gfxMgr.getParticleEffect("test", "boss.p").getEmitters().get(1));
	emit.setPosition(0, 0);
	emit.start();
	for(int i = 0; i < 20; i++) {
		emit.update(1f);
	}
	
	Game.gfxMgr.getSound("test", "drum.ogg").play(0.7f);
	
	Game.gfxMgr.getMusic("test", "theme.mp3").setLooping(true);
	Game.gfxMgr.getMusic("test", "theme.mp3").setVolume(0.35f);
	Game.gfxMgr.getMusic("test", "theme.mp3").play();
}
 
开发者ID:pixelgriffin,项目名称:SPACEJUNK,代码行数:65,代码来源:GameScene.java

示例7: explode

import com.badlogic.gdx.graphics.g2d.ParticleEmitter; //导入方法依赖的package包/类
public void explode(ParticleEmitter emitter)
{
	emitter.setPosition(this.body.getPosition().x, this.body.getPosition().y);
	emitter.start();
}
 
开发者ID:xzela,项目名称:catchr,代码行数:6,代码来源:Ball.java

示例8: newEmitter

import com.badlogic.gdx.graphics.g2d.ParticleEmitter; //导入方法依赖的package包/类
public ParticleEmitter newEmitter (String name, boolean select) {
	final ParticleEmitter emitter = new ParticleEmitter();

	emitter.getDuration().setLow(3000);

	emitter.getEmission().setHigh(250);

	emitter.getLife().setHigh(500, 1000);
	emitter.getLife().setTimeline(new float[] {0, 0.66f, 1});
	emitter.getLife().setScaling(new float[] {1, 1, 0.3f});

	emitter.getScale().setHigh(32, 32);

	emitter.getRotation().setLow(1, 360);
	emitter.getRotation().setHigh(180, 180);
	emitter.getRotation().setTimeline(new float[] {0, 1});
	emitter.getRotation().setScaling(new float[] {0, 1});
	emitter.getRotation().setRelative(true);

	emitter.getAngle().setHigh(45, 135);
	emitter.getAngle().setLow(90);
	emitter.getAngle().setTimeline(new float[] {0, 0.5f, 1});
	emitter.getAngle().setScaling(new float[] {1, 0, 0});
	emitter.getAngle().setActive(true);

	emitter.getVelocity().setHigh(30, 300);
	emitter.getVelocity().setActive(true);

	emitter.getTint().setColors(new float[] {1, 0.12156863f, 0.047058824f});

	emitter.getTransparency().setHigh(1, 1);
	emitter.getTransparency().setTimeline(new float[] {0, 0.2f, 0.8f, 1});
	emitter.getTransparency().setScaling(new float[] {0, 1, 0.75f, 0});

	emitter.setFlip(false, true);
	emitter.setMaxParticleCount(200);
	emitter.setImagePath("particle.png");

	Array<ParticleEmitter> emitters = editor.effect.getEmitters();
	if (emitters.size == 0)
		emitter.setPosition(editor.worldCamera.viewportWidth / 2, editor.worldCamera.viewportHeight / 2);
	else {
		ParticleEmitter p = emitters.get(0);
		emitter.setPosition(p.getX(), p.getY());
	}
	emitters.add(emitter);

	emitterTableModel.addRow(new Object[] {name, true});
	if (select) {
		editor.reloadRows();
		int row = emitterTableModel.getRowCount() - 1;
		emitterTable.getSelectionModel().setSelectionInterval(row, row);
	}
	return emitter;
}
 
开发者ID:tjumyk,项目名称:touhou-java,代码行数:56,代码来源:EffectPanel.java


注:本文中的com.badlogic.gdx.graphics.g2d.ParticleEmitter.setPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。