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


Java Rectangle.setAlpha方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: onShowScene

import org.andengine.entity.primitive.Rectangle; //导入方法依赖的package包/类
/**
 * Put all the objects in the scene.
 */
@Override
public void onShowScene() {
    
    // Sets difficulty:
    setTrialDiff(GameManager.getSelectedDiff());
    
    // Sets trial:
    GameManager.setCurrentTrial(GameManager.TRIAL_CUT);
    
    bg = new SpriteBackground(new Sprite(WIDTH * 0.5f, HEIGHT * 0.5f,
            ResourceManager.getInstance().cutBackground,
            ResourceManager.getInstance().engine.getVertexBufferObjectManager()));
    setBackground(bg);
    mTree = new Tree(WIDTH * 0.5f, HEIGHT * 0.5f + 400);
    candleLeft = new Candle(WIDTH * 0.5f - 500, HEIGHT * 0.5f + 200);
    candleRight = new Candle(WIDTH * 0.5f + 500, HEIGHT * 0.5f + 200);
    gameHUD = new GameHUD();
    precisionBar = new PrecisionBar(200f, 100f, timeRound);
    chrono = new Chronometer(WIDTH - 200, HEIGHT - 200, 10, 0);
    mCharacter = new Character(WIDTH / 2 - 120, HEIGHT / 2);
    mEyes = new Eyes();
    blinkLayer = new Rectangle(WIDTH / 2, HEIGHT / 2, WIDTH, HEIGHT,
            ResourceManager.getInstance().engine.getVertexBufferObjectManager());
    blinkLayer.setAlpha(0f);
    blinkLayer.setColor(1.0f, 1.0f, 1.0f);
    mKatana = new Katana();
    sweatDrop = new SweatDrop(mCharacter.getX() + SWEAT_DROP_X_SHIFT,
            mCharacter.getY() + SWEAT_DROP_Y_SHIFT);
    charSparkle = new CharSparkle(mCharacter.getX() + SPARKLE_X_SHIFT,
            mCharacter.getY() + SPARKLE_Y_SHIFT);
    headCharacterCut = new HeadCharacterCut(200f, 300f, GameManager.getSelectedCharacter());
    
    setBackgroundEnabled(true);
    attachChild(mTree);
    attachChild(candleLeft);
    attachChild(candleRight);
    ResourceManager.getInstance().engine.getCamera().setHUD(gameHUD);
    gameHUD.attachChild(precisionBar);
    gameHUD.attachChild(chrono);
    gameHUD.attachChild(headCharacterCut);
    attachChild(mCharacter);
    attachChild(mEyes);
    attachChild(blinkLayer);
    attachChild(mKatana);
    attachChild(sweatDrop);
    attachChild(charSparkle);
    
    SFXManager.playMusic(ResourceManager.getInstance().trialCut);
    readySequence();
}
 
开发者ID:jjhaggar,项目名称:ninja-trials,代码行数:54,代码来源:TrialSceneCut.java


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