2013-08-01 21 views
0

我正在開發一個遊戲,我必須與SpriteBatchNodeWIEngine SpriteBatchNode添加

的幫助下如何WiEngine使用SpriteBatch節點使用精靈?

SpriteBatchNode m_batchNode = SpriteBatchNode.make(Texture2D.makePNG(R.drawable.grossini_dance_atlas)); 
addChild(m_batchNode); 

我用下面的代碼。 我還需要SpriteEx實現與SpriteBatchNode

回答

0

您可以使用下面的代碼片段

SpriteBatchNode m_batchNode = SpriteBatchNode.make(Texture2D.makePNG(R.drawable.grossini_dance_atlas)); 
addChild(m_batchNode); 

    SpriteEx sprite = SpriteEx.make(m_batchNode, WYRect.make(x, y, ITEM_WIDTH, ITEM_HEIGHT)); 
      sprite.setFlipX(random.nextBoolean()); 
      sprite.setFlipY(random.nextBoolean()); 
      sprite.setRotation(random.nextFloat() * 360f); 
      sprite.setAutoFit(true); 
      sprite.setContentSize(random.nextFloat() * 200 + 50, random.nextFloat() * 200 + 50); 
      sprite.setPosition(pos.x, pos.y);