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


Java Sprite.setRotation方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.graphics.g2d.Sprite.setRotation方法的典型用法代碼示例。如果您正苦於以下問題:Java Sprite.setRotation方法的具體用法?Java Sprite.setRotation怎麽用?Java Sprite.setRotation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.graphics.g2d.Sprite的用法示例。


在下文中一共展示了Sprite.setRotation方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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);
}
 
開發者ID:UdealInferno,項目名稱:Parasites-of-HellSpace,代碼行數:25,代碼來源:Ion.java

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

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

示例5: Boom

import com.badlogic.gdx.graphics.g2d.Sprite; //導入方法依賴的package包/類
public Boom(float x, float y)
{
	texture = AssetLoader.assetManager.get("explosion.pack", TextureAtlas.class);
	animation = new Animation<TextureRegion>(1/15f, texture.getRegions());
	sprite = new Sprite(animation.getKeyFrame(0));
	elapsedTime = 0;
	sprite.setPosition(x, y);
	rotationAngle = MathUtils.random(359);
	sprite.setRotation(rotationAngle);
}
 
開發者ID:UdealInferno,項目名稱:Parasites-of-HellSpace,代碼行數:11,代碼來源:Boom.java


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