本文整理匯總了Java中com.badlogic.gdx.graphics.g2d.Sprite.setOriginCenter方法的典型用法代碼示例。如果您正苦於以下問題:Java Sprite.setOriginCenter方法的具體用法?Java Sprite.setOriginCenter怎麽用?Java Sprite.setOriginCenter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.graphics.g2d.Sprite
的用法示例。
在下文中一共展示了Sprite.setOriginCenter方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: Ion
import com.badlogic.gdx.graphics.g2d.Sprite; //導入方法依賴的package包/類
public Ion(float posX, float posY, boolean flip)
{
speed = 400;
lifeTime = 180;
flashLTime = 25;
damage = 2;
alive = true;
this.posX = posX;
this.posY = posY;
bulletTexture = AssetLoader.assetManager.get("ion.png", Texture.class);
bulletFlash = AssetLoader.assetManager.get("ionflash.png", Texture.class);
bulletSound = AssetLoader.assetManager.get("ionsnd.wav", Sound.class);
if(!flip)
bulletSound.play();
sprite = new Sprite(bulletTexture);
sprite.setOriginCenter();
sprite.setPosition(this.posX,this.posY);
this.flip = flip;
if(flip)
sprite.setRotation(180);
}
示例2: Rocket
import com.badlogic.gdx.graphics.g2d.Sprite; //導入方法依賴的package包/類
public Rocket(float posX, float posY, boolean flip)
{
speed = 300;
lifeTime = 180;
flashLTime = 25;
damage = 3;
alive = true;
this.posX = posX;
this.posY = posY;
bulletTexture = AssetLoader.assetManager.get("bullet.png", Texture.class);
bulletFlash = AssetLoader.assetManager.get("bulletflash.png", Texture.class);
bulletSound = AssetLoader.assetManager.get("bulletsnd.wav", Sound.class);
if(!flip)
bulletSound.play(0.5f);
sprite = new Sprite(bulletTexture);
sprite.setOriginCenter();
this.flip = flip;
if(flip)
sprite.setRotation(180);
}
示例3: create
import com.badlogic.gdx.graphics.g2d.Sprite; //導入方法依賴的package包/類
public void create()
{
posX = Gdx.graphics.getWidth()/2;
posY = Gdx.graphics.getHeight()/2-300;
speed = 400;
//Hardcoded staff. I could use textureAtlas but I'm lazy.
textures = new Texture[3];
textureRegionGuns = new TextureRegion[2];
textures[0] = AssetLoader.assetManager.get("spaceshipHull.png", Texture.class);
textures[1] = AssetLoader.assetManager.get("spaceshipGun.png", Texture.class);
textures[2] = AssetLoader.assetManager.get("spaceshipJet.png", Texture.class);
textureRegionGuns[0] = new TextureRegion(textures[1]);
textureRegionGuns[1] = new TextureRegion(textures[1]);
textureRegionGuns[0].flip(true, false);
sprite = new Sprite(textures[0]);
sprite.setOriginCenter();
sprite.setPosition(posX, posY);
bulletType = BulletType.ROCKET;
delay = delayWithAttack;
}
示例4: WeakEnemy
import com.badlogic.gdx.graphics.g2d.Sprite; //導入方法依賴的package包/類
public WeakEnemy(int choiceToMove, float xOffset, float yOffset)
{
health = 4;
this.choiceToMove = choiceToMove;
posX = xOffset;
posY = Gdx.graphics.getHeight() + 50 + yOffset;
texture = AssetLoader.assetManager.get("weakenemy.png", Texture.class);
sprite = new Sprite(texture);
sprite.setOriginCenter();
sprite.setRotation(180);
sprite.setPosition(posX, posY);
delayWithAttack = MathUtils.random(70f)+ 50f;
delay = delayWithAttack;
switch(choiceToMove)
{
case 0:
posX = -30 + xOffset;
bulletType = BulletType.ROCKET;
break;
case 1:
posX = Gdx.graphics.getWidth() + 30 + xOffset;
bulletType = BulletType.ION;
break;
case 2:
posX = Gdx.graphics.getWidth() / 2 + xOffset;
bulletType = BulletType.ROCKET;
break;
case 3:
posX = Gdx.graphics.getWidth() / 2 + xOffset;
bulletType = BulletType.ION;
break;
}
}
示例5: 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);
}
示例6: 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);
}
示例7: 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);
}
示例8: 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);
}