本文整理匯總了Java中com.badlogic.gdx.graphics.g2d.Sprite.setY方法的典型用法代碼示例。如果您正苦於以下問題:Java Sprite.setY方法的具體用法?Java Sprite.setY怎麽用?Java Sprite.setY使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.graphics.g2d.Sprite
的用法示例。
在下文中一共展示了Sprite.setY方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: GameActor
import com.badlogic.gdx.graphics.g2d.Sprite; //導入方法依賴的package包/類
public GameActor(TextureRegion actor_region,float x_pos,float y_pos,Color color,float width,float height) {
actor_texture = actor_region;
xpos = x_pos ;
ypos = y_pos ;
width_ =width ;
height_ = height;
actor_Sprite = new Sprite(actor_texture);
actor_Sprite.setX(xpos);
actor_Sprite.setY(ypos);
if(color != null){
actor_Sprite.setColor(color);}
actor_Sprite.setSize(width_, height_);
actor_Sprite.setOrigin(width_/2, height_/2);
setBounds(xpos, ypos, width_, height_);
this.setTouchable(Touchable.enabled);
}
示例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);
}
}