本文整理匯總了Java中com.badlogic.gdx.graphics.g2d.Sprite.setScale方法的典型用法代碼示例。如果您正苦於以下問題:Java Sprite.setScale方法的具體用法?Java Sprite.setScale怎麽用?Java Sprite.setScale使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.graphics.g2d.Sprite
的用法示例。
在下文中一共展示了Sprite.setScale方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: draw
import com.badlogic.gdx.graphics.g2d.Sprite; //導入方法依賴的package包/類
@Override
public void draw(Batch batch, float parentAlpha) {
if (sprite != null && !sprite.isEmpty() && !sprite.equals(NO_SPRITE)) {
Sprite render = layer.getGameSprite(sprite);
render.setPosition(MathUtils.round(getX()), MathUtils.round(getY()));
render.setRotation(getRotation());
render.setAlpha(getColor().a * parentAlpha);
render.setOrigin(getOriginX(), getOriginY());
render.setColor(getColor());
render.setSize(getWidth(), getHeight());
render.setScale(getScaleX(), getScaleY());
render.setFlip(flip_x, flip_y);
render.draw(batch);
}
super.draw(batch, parentAlpha);
}
示例2: initilizeTileObject
import com.badlogic.gdx.graphics.g2d.Sprite; //導入方法依賴的package包/類
/**
* Initialize position of sprite by the position of object from tiled map.
* If size 's values is not zero, the sprite will be scaled by the new size
*
* @param sprite
* the sprite will receive changes from tiled object
* @param object
* tiled object from tiled map
* @param size
*/
public void initilizeTileObject(Sprite sprite, TiledObject object,
float size) {
sprite.setX(object.x + object.width / 2);
sprite.setY(tileMapRenderer.getMapHeightUnits() - object.y
- object.height / 2);
if (size > 0) {
float s = object.width / size;
sprite.setScale(s);
}
}
示例3: HealthPack
import com.badlogic.gdx.graphics.g2d.Sprite; //導入方法依賴的package包/類
public HealthPack()
{
posX = MathUtils.random(350)+ 50;
posY = Gdx.graphics.getHeight();
speed = 150f;
texture = AssetLoader.assetManager.get("medkit.png", Texture.class);
powerUpSound = AssetLoader.assetManager.get("powerupsnd.wav", Sound.class);
sprite = new Sprite(texture);
sprite.setOriginCenter();
sprite.setScale(0.7f);
sprite.setPosition(posX, posY);
}
示例4: AmmoPack
import com.badlogic.gdx.graphics.g2d.Sprite; //導入方法依賴的package包/類
public AmmoPack()
{
posX = MathUtils.random(350)+ 50;
posY = Gdx.graphics.getHeight();
speed = 150f;
texture = AssetLoader.assetManager.get("ammo.png", Texture.class);
powerUpSound = AssetLoader.assetManager.get("powerupsnd.wav", Sound.class);
sprite = new Sprite(texture);
sprite.setOriginCenter();
sprite.setScale(0.7f);
sprite.setPosition(posX, posY);
}
示例5: UpgradePack
import com.badlogic.gdx.graphics.g2d.Sprite; //導入方法依賴的package包/類
public UpgradePack()
{
posX = MathUtils.random(350)+ 50;
posY = Gdx.graphics.getHeight();
speed = 150f;
texture = AssetLoader.assetManager.get("upgrade.png", Texture.class);
powerUpSound = AssetLoader.assetManager.get("powerupsnd.wav", Sound.class);
sprite = new Sprite(texture);
sprite.setOriginCenter();
sprite.setScale(0.7f);
sprite.setPosition(posX, posY);
}
示例6: loadSprites
import com.badlogic.gdx.graphics.g2d.Sprite; //導入方法依賴的package包/類
private void loadSprites() {
Texture texture = new Texture(Gdx.files.internal("tileset.png"));
minionSprite = new Sprite(texture, 15 * tilewidth + 1, 10 * tilewidth + 1, tilewidth, tilewidth);
float scale = 2;
minionSprite.setScale((mapHeight / (float) Gdx.graphics.getHeight()) / scale);
towerSprite = new Sprite(texture, 19 * tilewidth + 1, 7 * tilewidth + 1, tilewidth, tilewidth);
scale = 3;
towerSprite.setScale((mapHeight / (float) Gdx.graphics.getHeight()) / scale);
}
示例7: GodPack
import com.badlogic.gdx.graphics.g2d.Sprite; //導入方法依賴的package包/類
public GodPack()
{
posX = MathUtils.random(350)+ 50;
posY = Gdx.graphics.getHeight();
speed = 150f;
texture = AssetLoader.assetManager.get("god.png", Texture.class);
powerUpSound = AssetLoader.assetManager.get("powerupsnd.wav", Sound.class);
sprite = new Sprite(texture);
sprite.setOriginCenter();
sprite.setScale(0.7f);
sprite.setPosition(posX, posY);
}
示例8: loadSprite
import com.badlogic.gdx.graphics.g2d.Sprite; //導入方法依賴的package包/類
public static Sprite loadSprite(String id, String file, float scaleX, float scaleY) {
Sprite sprite = loadSprite(id, file);
sprite.setScale(scaleX, scaleY);
sprite.setOrigin(0, 0);
return sprite;
}