当前位置: 首页>>代码示例>>Java>>正文


Java Rectangle.setColor方法代码示例

本文整理汇总了Java中org.andengine.entity.primitive.Rectangle.setColor方法的典型用法代码示例。如果您正苦于以下问题:Java Rectangle.setColor方法的具体用法?Java Rectangle.setColor怎么用?Java Rectangle.setColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.andengine.entity.primitive.Rectangle的用法示例。


在下文中一共展示了Rectangle.setColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: HealthBar

import org.andengine.entity.primitive.Rectangle; //导入方法依赖的package包/类
public HealthBar(Enemy parent, VertexBufferObjectManager pVertexBufferObjectManager) {
	super(parent.mCenterX - (WIDTH + BORDER_THICKNESS * 2) / 2, parent.mCenterY - YOFFSET - BORDER_THICKNESS, WIDTH + BORDER_THICKNESS * 2, HEIGHT + BORDER_THICKNESS * 2, pVertexBufferObjectManager);
	
	// set variables
	mParent = parent;
	setColor(0.3f, 0.3f, 0.3f);
	setZIndex(800);
	TowerDefense.mSceneManager.getCurrentLevel().attachChild(this);
	
	// set background
	mHealthBackground = new Rectangle(mParent.mCenterX - WIDTH / 2, mParent.mCenterY - YOFFSET, WIDTH, HEIGHT, getVertexBufferObjectManager());
	mHealthBackground.setColor(220f/255, 25f/255, 25f/255);
	mHealthBackground.setZIndex(801);
	TowerDefense.mSceneManager.getCurrentLevel().attachChild(mHealthBackground);
	
	// set foreground
	mHealthForeground = new Rectangle(mParent.mCenterX - WIDTH / 2, mParent.mCenterY - YOFFSET, WIDTH, HEIGHT, getVertexBufferObjectManager());
	mHealthForeground.setColor(100f/255, 220f/255, 20f/255);
	mHealthForeground.setZIndex(802);
	TowerDefense.mSceneManager.getCurrentLevel().attachChild(mHealthForeground);
	
}
 
开发者ID:tamzi,项目名称:sophia,代码行数:23,代码来源:HealthBar.java

示例2: generateDiamond

import org.andengine.entity.primitive.Rectangle; //导入方法依赖的package包/类
/**
 * Generate a diamond centered on the desired position.
 * @param x the x position
 * @param y the y position
 * @return The entity corresponding to the created diamond.
 */
public Entity generateDiamond(float x, float y, float frequency) {
	Sprite sDiamond = new Sprite(x , y, this.spriteLoader.getDiamondTextureRegion(), this.vertextBufferObjectManager);
	sDiamond.setX(sDiamond.getX() - sDiamond.getWidth()/2);
	sDiamond.setY(sDiamond.getY() - sDiamond.getHeight()/2);
	Entity diamond = this.em.createEntity();
	this.em.addComponentToEntity(new SpriteComponent(sDiamond, true), diamond);
	
	Rectangle currLifeRect = new Rectangle(26, 242, 370, 80, this.vertextBufferObjectManager);
	currLifeRect.setColor(0.8f, 0.2f, 0.2f);
	Rectangle maxLifeRect = new Rectangle(26, 242, 370, 80, this.vertextBufferObjectManager);
	maxLifeRect.setColor(0.79f, 0.79f, 0.79f);
	this.em.addComponentToEntity(new DiamondComponent(frequency, 20, currLifeRect, maxLifeRect), diamond);
	
	return diamond;
}
 
开发者ID:Callilf,项目名称:RotatingSentries,代码行数:22,代码来源:EntityFactory.java

示例3: AbstractSkillComponent

import org.andengine.entity.primitive.Rectangle; //导入方法依赖的package包/类
/**
 * Constructor.
 * @param sprite the animation sprite
 * @param cooldown the cooldown of the attack
 */
public AbstractSkillComponent(Sprite sprite, Sprite frame, float cooldown, VertexBufferObjectManager vb) {
	this.iconSprite = sprite;
	this.iconSprite.setZIndex(10);
	this.iconFrame = frame;
	this.iconFrame.setZIndex(12);
	this.cooldown = cooldown;
	this.ready = true;
	
	Rectangle cooldownRect = new Rectangle(sprite.getX() + 3, sprite.getY() + 3, sprite.getWidth() -6 , sprite.getHeight() - 6, vb);
	cooldownRect.setColor(0, 0, 0, 0.5f);
	this.cooldownRectangle = cooldownRect;
	this.cooldownRectangle.setZIndex(11);
	this.cooldownRectangle.setVisible(false);
	this.cooldownRectangeMaxHeight = cooldownRect.getHeight();
}
 
开发者ID:Callilf,项目名称:RotatingSentries,代码行数:21,代码来源:AbstractSkillComponent.java

示例4: defineRectangularHitbox

import org.andengine.entity.primitive.Rectangle; //导入方法依赖的package包/类
/**
 * Set the hitbox relatively to the Sprite
 * 
 * @param xmin left distance to the sprite
 * @param ymin top distance to the sprite
 * @param width width of the hitbox
 * @param height height of the hitbox
 * @return this so this call can be inline
 */
public SpriteComponent defineRectangularHitbox(float xmin, float ymin, float width, float height) {
	//sprite.setColor(Color.RED);
	hitbox = new Rectangle(xmin, ymin, width, height, sprite.getVertexBufferObjectManager());
	
	if (GameActivity.DEBUG_MODE) {
		hitbox.setVisible(true); // to set to false
		hitbox.setAlpha(10); // DON'T WORK
		hitbox.setColor(Color.BLUE);
	} else {
		hitbox.setVisible(false);
	}
	
	sprite.attachChild(hitbox);
	return this;
}
 
开发者ID:Callilf,项目名称:RotatingSentries,代码行数:25,代码来源:SpriteComponent.java

示例5: addRectangles

import org.andengine.entity.primitive.Rectangle; //导入方法依赖的package包/类
private void addRectangles() {

        Rectangle rectangleScore = new Rectangle(0, (float) (camera.getHeight() * 0.45), camera.getWidth(),
                textFieldHeight, vbom);
        rectangleScore.setColor(0, 102 / 255f, 255 / 255f);
        attachChild(rectangleScore);

        Rectangle rectangleLevel = new Rectangle(0, rectangleScore.getY() + textFieldHeight, camera.getWidth(),
                rectangleScore.getHeight(), vbom);
        rectangleLevel.setColor(YELLOW);
        attachChild(rectangleLevel);

        if (justPlayScoreService.getHighscore() != null) {
            Rectangle rectangleHighscore = new Rectangle(0, rectangleLevel.getY() + textFieldHeight, camera.getWidth(),
                    textFieldHeight, vbom);
            rectangleHighscore.setColor(153 / 255f, 102 / 255f, 0);
            attachChild(rectangleHighscore);
        }
    }
 
开发者ID:djschilling,项目名称:sopa,代码行数:20,代码来源:JustPlayLostScene.java

示例6: Pillar

import org.andengine.entity.primitive.Rectangle; //导入方法依赖的package包/类
public Pillar(float x, float y, TextureRegion reg, VertexBufferObjectManager vbom, PhysicsWorld physics) {
	super(x, y);
	pillarUp = new Sprite(0, shift, 96, 384, reg, vbom);
	pillarUp.setFlippedVertical(true);
	pillarUp.setAnchorCenterY(0);
	attachChild(pillarUp);
	
	pillarUpBody = PhysicsFactory.createBoxBody(physics, pillarUp, BodyType.StaticBody, Constants.WALL_FIXTURE);
	pillarUpBody.setUserData(Constants.BODY_WALL);
	
	pillarDown = new Sprite(0, -shift, 96, 384, reg, vbom);
	pillarDown.setAnchorCenterY(1);
	attachChild(pillarDown);	

	pillarDownBody = PhysicsFactory.createBoxBody(physics, pillarDown, BodyType.StaticBody, Constants.WALL_FIXTURE);
	pillarDownBody.setUserData(Constants.BODY_WALL);

	Rectangle r = new Rectangle(0, 0, 1, 9999, vbom); // just to make sure it's big
	r.setColor(Color.GREEN);
	r.setAlpha(0f);
	attachChild(r);
	
	scoreSensor = PhysicsFactory.createBoxBody(physics, r, BodyType.StaticBody, Constants.SENSOR_FIXTURE);
	scoreSensor.setUserData(Constants.BODY_SENSOR);

}
 
开发者ID:sm4,项目名称:FlyingDandelion,代码行数:27,代码来源:Pillar.java

示例7: initInfoMessageText

import org.andengine.entity.primitive.Rectangle; //导入方法依赖的package包/类
/**
 * 戦闘ログテキスト初期化
 */
private void initInfoMessageText(IEntity entity) {
	float width = getBaseScene().getWindowWidth() - (getBaseScene().getWindowWidth() / 10);
	float height = 40;
	Rectangle rectangle = getBaseScene().createRectangle(0, 0, width, height);
	rectangle.setColor(Color.BLACK);
	rectangle.setAlpha(0.5f);
	rectangle.setZIndex(LayerZIndexType.TEXT_LAYER.getValue());
	rectangle.setTag(INFO_MESSAGE_TEXT_TAG);
	
	Text text = new Text(10, 10, getBaseScene().createFont(Typeface.DEFAULT, 20, Color.WHITE), 
			"000000000000000000000000000000000000000000000000000000000000000", 
			getBaseScene().getBaseActivity().getVertexBufferObjectManager());
	rectangle.attachChild(text);

	getBaseScene().placeToCenterX(rectangle, 10);
	rectangle.setVisible(false);
	
	entity.attachChild(rectangle);
}
 
开发者ID:kyokomi,项目名称:AndEngineSRPGQuest,代码行数:23,代码来源:BattlePart.java

示例8: createTextRectangle

import org.andengine.entity.primitive.Rectangle; //导入方法依赖的package包/类
public Rectangle createTextRectangle(String titleStr, Font titleFont, String detatilStr, Font detailFont,
		VertexBufferObjectManager pVertexBufferObjectManager) {
	
	Text titleText = new Text(0, 0, titleFont, titleStr, 
			pVertexBufferObjectManager);
	Text detatilText = new Text(0, 0, detailFont, detatilStr, 
			pVertexBufferObjectManager);
	titleText.setPosition(0, 0);
	detatilText.setPosition(titleText.getX() + titleText.getWidth(), titleText.getY());
	
	float textWidth = titleText.getWidth() + detatilText.getWidth();
	float textHeight = titleText.getHeight();
	Rectangle resultRectangle = new Rectangle(0, 0, textWidth, textHeight, 
			pVertexBufferObjectManager);
	
	resultRectangle.setColor(Color.TRANSPARENT);
	resultRectangle.setAlpha(0.0f);
	resultRectangle.attachChild(titleText);
	resultRectangle.attachChild(detatilText);
	return resultRectangle;
}
 
开发者ID:kyokomi,项目名称:AndEngineSRPGQuest,代码行数:22,代码来源:TextLogic.java

示例9: initializeWarningFlash

import org.andengine.entity.primitive.Rectangle; //导入方法依赖的package包/类
private void initializeWarningFlash() {

        gameViewBackground = new Rectangle(0f, getTileSceneStartY() + spacePerTile, camera.getWidth(),
                camera.getWidth(), vbom);
        gameViewBackground.setColor(1f, 1f, 1f, 0f);
        attachChild(gameViewBackground);
    }
 
开发者ID:djschilling,项目名称:sopa,代码行数:8,代码来源:JustPlayGameScene.java

示例10: addRectangles

import org.andengine.entity.primitive.Rectangle; //导入方法依赖的package包/类
private void addRectangles() {

        Rectangle rectangleScore = new Rectangle(0, (float) (camera.getHeight() * 0.45), camera.getWidth(),
                camera.getHeight() * 0.085f, vbom);
        rectangleScore.setColor(0, 102 / 255f, 255 / 255f);
        attachChild(rectangleScore);

        Rectangle rectangleTime = new Rectangle(0, (float) (camera.getHeight() * 0.6), camera.getWidth(),
                camera.getHeight() * 0.17f, vbom);
        rectangleTime.setColor(153 / 255f, 0, 0);
        attachChild(rectangleTime);
    }
 
开发者ID:djschilling,项目名称:sopa,代码行数:13,代码来源:JustPlayScoreScene.java

示例11: createEntityFactory

import org.andengine.entity.primitive.Rectangle; //导入方法依赖的package包/类
private static IEntityFactory<Rectangle> createEntityFactory(final VertexBufferObjectManager vbom) {

        return new IEntityFactory<Rectangle>() {
            @Override
            public Rectangle create(final float pX, final float pY) {

                Rectangle rectangle = new Rectangle(pX, pY, 30, 15, vbom);
                rectangle.setColor(COLOR_MAP[getRandomBetweenZeroAndThree()]);
                rectangle.registerEntityModifier(new RotationModifier(7f, (float) Math.random() * 360,
                        (7 - (float) Math.random() * 15) * 360));
                rectangle.registerEntityModifier(new AlphaModifier(4f, 0.7f, 0f));
                return rectangle;
            }};
    }
 
开发者ID:djschilling,项目名称:sopa,代码行数:15,代码来源:ConfettiParticleSystem.java

示例12: showTargetCursor

import org.andengine.entity.primitive.Rectangle; //导入方法依赖的package包/类
/**
 * ターゲットカーソル表示。
 * @param actorPlayerDto アクター情報
 */
private void showTargetCursor(ActorPlayerDto actorPlayerDto) {
	// TODO: ターゲットカーソルは後で画像を用意する
	AnimatedSprite actorSprite = findActorSprite(actorPlayerDto.getPlayerId()).getPlayer();
	Rectangle cursorRectangle = new Rectangle(actorSprite.getX(), actorSprite.getY(), 50, 50, 
			getBaseScene().getBaseActivity().getVertexBufferObjectManager());
	cursorRectangle.setColor(Color.YELLOW);
	cursorRectangle.setAlpha(0.5f);
	cursorRectangle.setTag(TARGET_CURSOR_TAG);
	mBaseLayer.attachChild(cursorRectangle);
}
 
开发者ID:kyokomi,项目名称:AndEngineSRPGQuest,代码行数:15,代码来源:BattlePart.java

示例13: PowerBar

import org.andengine.entity.primitive.Rectangle; //导入方法依赖的package包/类
public PowerBar(float posX, float posY, int minPower, int maxPower) {
       this.minPower = minPower;
       this.maxPower = maxPower;
	bar = new Sprite(posX, posY, ResourceManager.getInstance().hudPowerBarPush,
              ResourceManager.getInstance().engine.getVertexBufferObjectManager());
       rect = new Rectangle(posX, posY, rectWidth, rectHeight,
               ResourceManager.getInstance().engine.getVertexBufferObjectManager());
	rect.setColor(0f, 0f, 0f);
	rect.setScaleCenterY(1);
	attachChild(bar);
	attachChild(rect);
}
 
开发者ID:jjhaggar,项目名称:ninja-trials,代码行数:13,代码来源:PowerBar.java

示例14: onShowLayer

import org.andengine.entity.primitive.Rectangle; //导入方法依赖的package包/类
@Override
public void onShowLayer() {
    rec = new Rectangle(WIDTH / 2, HEIGHT / 2, WIDTH, HEIGHT,
            ResourceManager.getInstance().engine.getVertexBufferObjectManager());
    rec.setAlpha(0f);
    rec.setColor(0f, 0f, 0f);
    attachChild(rec);

    gameOver = new Text(WIDTH/2, HEIGHT/2,
            ResourceManager.getInstance().fontXBig,  
            ResourceManager.getInstance().loadAndroidRes().getString(R.string.result_lose_game_over),
            new TextOptions(HorizontalAlign.CENTER),
            ResourceManager.getInstance().engine.getVertexBufferObjectManager());
    attachChild(gameOver);

    rec.registerEntityModifier(new FadeInModifier(5f));

    // Timer:
    timerHandler= new TimerHandler(GAME_OVER_TIME, new ITimerCallback()
    {
        @Override
        public void onTimePassed(final TimerHandler pTimerHandler)
        {
            ResourceManager.getInstance().engine.unregisterUpdateHandler(timerHandler);
            SceneManager.getInstance().hideLayer();
            if(GameManager.DEBUG_MODE)
                SceneManager.getInstance().showScene(new TestingScene());
            else
                SceneManager.getInstance().showScene(new MainMenuScene());
        }
    });
    ResourceManager.getInstance().engine.registerUpdateHandler(timerHandler);

    // Sound & Music;
    // TODO: game over sound not ready (andengine bug) 
    SFXManager.playSound(ResourceManager.getInstance().gameOver);
    SFXManager.playMusic(ResourceManager.getInstance().gameOverMusic);
}
 
开发者ID:jjhaggar,项目名称:ninja-trials,代码行数:39,代码来源:GameOverLayer.java

示例15: init

import org.andengine.entity.primitive.Rectangle; //导入方法依赖的package包/类
public void init(ActorPlayerDto player, ActorPlayerDto enemy, BattleInitType pBattleInitType) {
	Log.d("BattlePart", player.toString());
	Log.d("BattlePart", enemy.toString());
	
	changeState(BattleStateType.INIT);

	mBattleInitType = pBattleInitType;
	mPlayerList = new ArrayList<ActorPlayerDto>();
	mEnemyList = new ArrayList<ActorPlayerDto>();
	mPlayerList.add(player);
	mEnemyList.add(enemy);
	
	// 上に重ねる用にBaseを用意
	mBaseLayer = new Rectangle(0, 0, 
			getBaseScene().getWindowWidth(), getBaseScene().getWindowHeight(), 
			getBaseScene().getBaseActivity().getVertexBufferObjectManager());
	mBaseLayer.setColor(Color.TRANSPARENT);
	
	initDamageText(mBaseLayer);
	initInfoMessageText(mBaseLayer);
	
	// 背景表示
	initBackground();
	// 背景画像の都合で表示位置が決まる
	float acotrBaseY = getBaseScene().getWindowHeight() / 2;
	
	// キャラ表示
	ActorBattleSprite playerSprite = new ActorBattleSprite(player, getBaseScene(), 0, 0, 64, 64);
	playerSprite.setSize(64, 64);
	playerSprite.setTag(player.getPlayerId());
	// 右上から表示
	playerSprite.setPosition(getBaseScene().getWindowWidth() - 
			(getBaseScene().getWindowWidth() / 8) -
			playerSprite.getWidth(), 
			acotrBaseY);
	mBaseLayer.attachChild(playerSprite);
	
	// キャラ表示
	ActorBattleSprite enemySprite = new ActorBattleSprite(enemy, getBaseScene(), 0, 0, 64, 64);
	enemySprite.setSize(64, 64);
	enemySprite.setTag(enemy.getPlayerId());
	// 左上から表示
	enemySprite.setPosition(getBaseScene().getWindowWidth() / 8, 
			acotrBaseY);
	mBaseLayer.attachChild(enemySprite);
	
	// 攻撃エフェクトを用意
	// TODO: ファイル固定にしているけど、wewaponImgResIdでから引っ張れるようにする
	AnimatedSprite playerAttackEffectSprite = getBaseScene().getResourceAnimatedSprite(
			"effect/rapier.png", 5, 4);
	playerAttackEffectSprite.setVisible(false);
	playerAttackEffectSprite.setTag(ACTOR_ATTACK_EFFETC_TAG + player.getEquipDto().getWeaponImgResId());
	mBaseLayer.attachChild(playerAttackEffectSprite);
	
	AnimatedSprite enemyAttackEffectSprite = getBaseScene().getResourceAnimatedSprite(
			"effect/shock.png", 5, 2);
	enemyAttackEffectSprite.setVisible(false);
	enemyAttackEffectSprite.setColor(Color.YELLOW);
	enemyAttackEffectSprite.setTag(ACTOR_ATTACK_EFFETC_TAG + enemy.getEquipDto().getWeaponImgResId()); 
	mBaseLayer.attachChild(enemyAttackEffectSprite);
	
	// ベースレイヤをattach
	getBaseScene().attachChild(mBaseLayer);
	mBaseLayer.sortChildren();
	
	changeState(BattleStateType.START);
}
 
开发者ID:kyokomi,项目名称:AndEngineSRPGQuest,代码行数:68,代码来源:BattlePart.java


注:本文中的org.andengine.entity.primitive.Rectangle.setColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。