當前位置: 首頁>>代碼示例>>Java>>正文


Java Sprite.setScale方法代碼示例

本文整理匯總了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);
}
 
開發者ID:kyperbelt,項目名稱:KyperBox,代碼行數:17,代碼來源:GameObject.java

示例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);
	}
}
 
開發者ID:game-libgdx-unity,項目名稱:GDX-Engine,代碼行數:22,代碼來源:TiledScene.java

示例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);
}
 
開發者ID:UdealInferno,項目名稱:Parasites-of-HellSpace,代碼行數:13,代碼來源:HealthPack.java

示例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);
}
 
開發者ID:UdealInferno,項目名稱:Parasites-of-HellSpace,代碼行數:13,代碼來源:AmmoPack.java

示例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);
}
 
開發者ID:UdealInferno,項目名稱:Parasites-of-HellSpace,代碼行數:13,代碼來源:UpgradePack.java

示例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);
}
 
開發者ID:MiniDigger,項目名稱:projecttd,代碼行數:12,代碼來源:GameScreen.java

示例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);
}
 
開發者ID:UdealInferno,項目名稱:Parasites-of-HellSpace,代碼行數:13,代碼來源:GodPack.java

示例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;
}
 
開發者ID:dsaves,項目名稱:Ponytron,代碼行數:7,代碼來源:AssetDoctor.java


注:本文中的com.badlogic.gdx.graphics.g2d.Sprite.setScale方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。