Merge pull request #1205 from minggo/gles20

use CCSprite::createWithSpriteFrame() to create a sprite
This commit is contained in:
minggo 2012-08-20 02:29:34 -07:00
commit e2140aea0b
1 changed files with 3 additions and 3 deletions

View File

@ -58,7 +58,7 @@ local function creatDog()
end
-- create farm
local function createLayerFram()
local function createLayerFarm()
local layerFarm = CCLayer:create()
-- add in farm background
@ -79,7 +79,7 @@ local function createLayerFram()
local frameCrop = CCSpriteFrame:create("crop.png", CCRectMake(0, 0, 105, 95))
for i = 0, 3 do
for j = 0, 1 do
local spriteCrop = CCSprite:create(frameCrop);
local spriteCrop = CCSprite:createWithSpriteFrame(frameCrop);
spriteCrop:setPosition(10 + 200 + j * 180 - i % 2 * 90, 30 + 10 + i * 95 / 2)
layerFarm:addChild(spriteCrop)
end
@ -177,6 +177,6 @@ SimpleAudioEngine:sharedEngine():preloadEffect("effect1.wav");
-- run
local sceneGame = CCScene:create()
sceneGame:addChild(createLayerFram())
sceneGame:addChild(createLayerFarm())
sceneGame:addChild(createLayerMenu())
CCDirector:sharedDirector():runWithScene(sceneGame)