本文整理匯總了Java中com.badlogic.ashley.tests.systems.MovementSystem類的典型用法代碼示例。如果您正苦於以下問題:Java MovementSystem類的具體用法?Java MovementSystem怎麽用?Java MovementSystem使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
MovementSystem類屬於com.badlogic.ashley.tests.systems包,在下文中一共展示了MovementSystem類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: create
import com.badlogic.ashley.tests.systems.MovementSystem; //導入依賴的package包/類
@Override
public void create () {
OrthographicCamera camera = new OrthographicCamera(640, 480);
camera.position.set(320, 240, 0);
camera.update();
Texture crateTexture = new Texture("assets/crate.png");
Texture coinTexture = new Texture("assets/coin.png");
engine = new PooledEngine();
engine.addSystem(new RenderSystem(camera));
engine.addSystem(new MovementSystem());
Entity crate = engine.createEntity();
crate.add(new PositionComponent(50, 50));
crate.add(new VisualComponent(new TextureRegion(crateTexture)));
engine.addEntity(crate);
TextureRegion coinRegion = new TextureRegion(coinTexture);
for (int i = 0; i < 100; i++) {
Entity coin = engine.createEntity();
coin.add(new PositionComponent(MathUtils.random(640), MathUtils.random(480)));
coin.add(new MovementComponent(10.0f, 10.0f));
coin.add(new VisualComponent(coinRegion));
engine.addEntity(coin);
}
}
示例2: create
import com.badlogic.ashley.tests.systems.MovementSystem; //導入依賴的package包/類
@Override
public void create() {
OrthographicCamera camera = new OrthographicCamera(640, 480);
camera.position.set(320, 240, 0);
camera.update();
Texture crateTexture = new Texture("assets/crate.png");
Texture coinTexture = new Texture("assets/coin.png");
engine = new PooledEngine();
engine.addSystem(new RenderSystem(camera));
engine.addSystem(new MovementSystem());
Entity crate = engine.createEntity();
crate.add(new PositionComponent(50, 50));
crate.add(new VisualComponent(new TextureRegion(crateTexture)));
engine.addEntity(crate);
TextureRegion coinRegion = new TextureRegion(coinTexture);
for (int i = 0; i < 100; i++) {
Entity coin = engine.createEntity();
coin.add(new PositionComponent(MathUtils.random(640), MathUtils.random(480)));
coin.add(new MovementComponent(10.0f, 10.0f));
coin.add(new VisualComponent(coinRegion));
engine.addEntity(coin);
}
}