本文整理汇总了Java中org.andengine.entity.sprite.Sprite.setHeight方法的典型用法代码示例。如果您正苦于以下问题:Java Sprite.setHeight方法的具体用法?Java Sprite.setHeight怎么用?Java Sprite.setHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.andengine.entity.sprite.Sprite
的用法示例。
在下文中一共展示了Sprite.setHeight方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TestTower
import org.andengine.entity.sprite.Sprite; //导入方法依赖的package包/类
public TestTower(BasePoint parent, VertexBufferObjectManager pVertexBufferObjectManager) {
super(parent, OFFSET_X, OFFSET_Y, TEXTURE, pVertexBufferObjectManager);
// set variables
mName = NAME;
mRange = RANGE;
mDelay = DELAY;
mDamage = (float) TestRound.DAMAGE * (1000f / mDelay);
mScanMethod = SCAN_METHOD;
mPrice = PRICE;
mOptions.add(Option.LOCKED);
mOptions.add(Option.BUILD_TOWER_PEBBLE);
mOptions.add(Option.LOCKED);
// build range circle //TODO create a RangeCircle class
mRangeCircle = new Sprite(mCenterX - mRange, mCenterY - (mRange * TowerDefense.PERSPECTIVE), TowerDefense.TEXTURE_RANGECIRCLE, getVertexBufferObjectManager());
float scale = (mRange * 2) / TowerDefense.TEXTURE_RANGECIRCLE.getWidth();
mRangeCircle.setWidth(mRangeCircle.getWidth() * scale);
mRangeCircle.setHeight(mRangeCircle.getHeight() * scale);
mRangeCircle.setZIndex(TowerDefense.ZINDEX_TOWERS - 1);
mRangeCircle.setVisible(false);
TowerDefense.mSceneManager.getCurrentLevel().attachChild(mRangeCircle);
}
示例2: PebbleTower
import org.andengine.entity.sprite.Sprite; //导入方法依赖的package包/类
public PebbleTower(BasePoint parent, VertexBufferObjectManager pVertexBufferObjectManager) {
super(parent, OFFSET_X, OFFSET_Y, TEXTURE, pVertexBufferObjectManager);
// set variables
mName = NAME;
mRange = RANGE;
mDelay = DELAY;
mDamage = (float) TestRound.DAMAGE * (1000f / mDelay);
mScanMethod = SCAN_METHOD;
mPrice = PRICE;
mOptions.add(Option.LOCKED);
mOptions.add(Option.LOCKED);
mOptions.add(Option.LOCKED);
// build range circle //TODO create a RangeCircle class
mRangeCircle = new Sprite(mCenterX - mRange, mCenterY - (mRange * TowerDefense.PERSPECTIVE), TowerDefense.TEXTURE_RANGECIRCLE, getVertexBufferObjectManager());
float scale = (mRange * 2) / TowerDefense.TEXTURE_RANGECIRCLE.getWidth();
mRangeCircle.setWidth(mRangeCircle.getWidth() * scale);
mRangeCircle.setHeight(mRangeCircle.getHeight() * scale);
mRangeCircle.setZIndex(TowerDefense.ZINDEX_TOWERS - 1);
mRangeCircle.setVisible(false);
TowerDefense.mSceneManager.getCurrentLevel().attachChild(mRangeCircle);
}
示例3: SlowTower
import org.andengine.entity.sprite.Sprite; //导入方法依赖的package包/类
public SlowTower(BasePoint parent, VertexBufferObjectManager pVertexBufferObjectManager) {
super(parent, OFFSET_X, OFFSET_Y, TEXTURE, pVertexBufferObjectManager);
// set variables
mName = NAME;
mRange = RANGE;
mDelay = DELAY;
mDamage = (float) SlowRound.DAMAGE * (1000f / mDelay);
mScanMethod = SCAN_METHOD;
mPrice = PRICE;
mOptions.add(Option.LOCKED);
mOptions.add(Option.LOCKED);
mOptions.add(Option.LOCKED);
// build range circle //TODO create a RangeCircle class
mRangeCircle = new Sprite(mCenterX - mRange, mCenterY - (mRange * TowerDefense.PERSPECTIVE), TowerDefense.TEXTURE_RANGECIRCLE, getVertexBufferObjectManager());
float scale = (mRange * 2) / TowerDefense.TEXTURE_RANGECIRCLE.getWidth();
mRangeCircle.setWidth(mRangeCircle.getWidth() * scale);
mRangeCircle.setHeight(mRangeCircle.getHeight() * scale);
mRangeCircle.setZIndex(TowerDefense.ZINDEX_TOWERS - 1);
mRangeCircle.setVisible(false);
TowerDefense.mSceneManager.getCurrentLevel().attachChild(mRangeCircle);
}
示例4: FireTower
import org.andengine.entity.sprite.Sprite; //导入方法依赖的package包/类
public FireTower(BasePoint parent, VertexBufferObjectManager pVertexBufferObjectManager) {
super(parent, OFFSET_X, OFFSET_Y, TEXTURE, pVertexBufferObjectManager);
// set variables
mName = NAME;
mRange = RANGE;
mDelay = DELAY;
mDamage = (float) FireBallRound.DAMAGE * (1000f / mDelay);
mScanMethod = SCAN_METHOD;
mPrice = PRICE;
mOptions.add(Option.LOCKED);
mOptions.add(Option.BUILD_TOWER_FLAMETHROWER);
mOptions.add(Option.LOCKED);
// build range circle //TODO create a RangeCircle class
mRangeCircle = new Sprite(mCenterX - mRange, mCenterY - (mRange * TowerDefense.PERSPECTIVE), TowerDefense.TEXTURE_RANGECIRCLE, getVertexBufferObjectManager());
float scale = (mRange * 2) / TowerDefense.TEXTURE_RANGECIRCLE.getWidth();
mRangeCircle.setWidth(mRangeCircle.getWidth() * scale);
mRangeCircle.setHeight(mRangeCircle.getHeight() * scale);
mRangeCircle.setZIndex(TowerDefense.ZINDEX_TOWERS - 1);
mRangeCircle.setVisible(false);
TowerDefense.mSceneManager.getCurrentLevel().attachChild(mRangeCircle);
}
示例5: FlamethrowerTower
import org.andengine.entity.sprite.Sprite; //导入方法依赖的package包/类
public FlamethrowerTower(BasePoint parent, VertexBufferObjectManager pVertexBufferObjectManager) {
super(parent, OFFSET_X, OFFSET_Y, TEXTURE, pVertexBufferObjectManager);
// set variables
mName = NAME;
mRange = RANGE;
mDelay = DELAY;
mDamage = (float) FlameRound.DAMAGE * (1000f / mDelay);
mScanMethod = SCAN_METHOD;
mPrice = PRICE;
mOptions.add(Option.LOCKED);
// build range circle //TODO create a RangeCircle class
mRangeCircle = new Sprite(mCenterX - mRange, mCenterY - (mRange * TowerDefense.PERSPECTIVE), TowerDefense.TEXTURE_RANGECIRCLE, getVertexBufferObjectManager());
float scale = (mRange * 2) / TowerDefense.TEXTURE_RANGECIRCLE.getWidth();
mRangeCircle.setWidth(mRangeCircle.getWidth() * scale);
mRangeCircle.setHeight(mRangeCircle.getHeight() * scale);
mRangeCircle.setZIndex(TowerDefense.ZINDEX_TOWERS - 1);
mRangeCircle.setVisible(false);
TowerDefense.mSceneManager.getCurrentLevel().attachChild(mRangeCircle);
}
示例6: doInBackground
import org.andengine.entity.sprite.Sprite; //导入方法依赖的package包/类
@Override
protected Sprite doInBackground(final String... params) {
try {
ITexture mTexture = new BitmapTexture(engine.getTextureManager(), new IInputStreamOpener() {
@Override
public InputStream open() throws IOException {
URL url = new URL(params[0]);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
return new BufferedInputStream(input);
}
});
mTexture.load();
textureRegionAnotherPlayer = TextureRegionFactory.extractFromTexture(mTexture);
if (GameManager.getInstance() != null && GameManager.getInstance().players != null &&
GameManager.getInstance().players.length > 0 && engine != null) {
IEntity entity = GameManager.getInstance().players[1].tabSprite;
Sprite user = new Sprite(0, 0, textureRegionAnotherPlayer, engine.getVertexBufferObjectManager());
user.setWidth(entity.getHeight() - 27);
user.setHeight(entity.getHeight() - 27);
user.setX(-13 + entity.getWidth() / 2);
user.setY(+4 + entity.getHeight() / 2);
return user;
}
} catch (IOException e) {
Debug.e(e);
}
return null;
}
示例7: GameScene
import org.andengine.entity.sprite.Sprite; //导入方法依赖的package包/类
public GameScene(final ResourceManager pResourceManager, final Camera pCamera, GameActivity pContext) {
super();
mContext = pContext;
mBackgroundSprite = new Sprite(0, 0, pResourceManager.mBackgroundRegion, mContext.getVertexBufferObjectManager());
mBackgroundSprite.setHeight(pCamera.getHeight() + 4);
mBackgroundSprite.setWidth(pCamera.getWidth());
mBackground = new VerticalParallaxBackground(193 / 255f, 208 / 255f, 170 / 255f) {
};
mBackground.attachVerticalParallaxEntity(new VerticalParallaxEntity(1.2f, mBackgroundSprite));
setBackground(mBackground);
mGameOverTextColor = new Color(253 / 255f, 255 / 255f, 225 / 255f);
}
示例8: createBackground
import org.andengine.entity.sprite.Sprite; //导入方法依赖的package包/类
private void createBackground(final Bitmap background, @Nullable final String backgroundUrl) {
if (background == null) return;
BitmapTextureAtlas bitmapTextureAtlas = new BitmapTextureAtlas(_engine.getTextureManager(), _width, _height, TextureOptions.BILINEAR);
IBitmapTextureAtlasSource baseTextureSource = new EmptyBitmapTextureAtlasSource(_width, _height);
final IBitmapTextureAtlasSource bitmapTextureAtlasSource = new BaseBitmapTextureAtlasSourceDecorator(baseTextureSource) {
@Override
protected void onDecorateBitmap(Canvas pCanvas) throws Exception {
if (backgroundUrl != null) {
Bitmap template = BitmapFactory.decodeStream(GoogleFlipGameApplication.sContext.getAssets().open(backgroundUrl));
pCanvas.drawBitmap(template, 0, 0, mPaint);
}
pCanvas.drawColor(_backgroundColor);
pCanvas.drawBitmap(background, 0, 0, mPaint);
}
@Override
public BaseBitmapTextureAtlasSourceDecorator deepCopy() {
throw new IModifier.DeepCopyNotSupportedException();
}
};
ITextureRegion mDecoratedBalloonTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromSource(bitmapTextureAtlas, bitmapTextureAtlasSource,
0, 0);
bitmapTextureAtlas.load();
Sprite sprite = new Sprite(0, 0, mDecoratedBalloonTextureRegion, _engine.getVertexBufferObjectManager());
sprite.setOffsetCenter(0, 0);
sprite.setWidth(_width);
sprite.setHeight(_height);
_background = new SpriteBackground(sprite);
_engine.getScene().setBackground(_background);
}