示例#1
0
    /*
     * Attach the LevelTile's text to itself based on whether it's locked or
     * not. If not, then the level number will be displayed on the level
     * tile.
     */
    public void attachStar() {

      /* Determine the tile's string based on whether it's locked or not*/
      if (this.mIsLocked) {
        mStar.setCurrentTileIndex(0);

      } else {
        mStar.setCurrentTileIndex(mNumStars);
      }

      /* Setup the text position to be placed in the center-bottom of the tile */
      final float starPositionX = LevelSelector.this.TILE_DIMENSION / 6 + 5;
      final float starPositionY = LevelSelector.this.TILE_DIMENSION - 15;

      /* Attach the mStar to the LevelTile */
      StarSprite =
          new Sprite(0, 0, mStar, LevelSelector.this.mEngine.getVertexBufferObjectManager());
      this.attachChild(StarSprite);
      StarSprite.setPosition(starPositionX, starPositionY + 15);
    }