mirror of https://github.com/axmolengine/axmol.git
fix all xcode4 templates before version release.
1. modify version description in install-teampltes-xcode.sh 2. replace the deprecated methods in box2d/HelloWorldScene.cpp 3. fix the error usage in hello.lua 4. add effect & BGM in HelloLua 5. update baisc cocos2dx library file list
This commit is contained in:
parent
e338779fb8
commit
3b97f4d73a
|
@ -2,7 +2,7 @@
|
|||
|
||||
echo 'cocos2d-x template installer'
|
||||
|
||||
COCOS2D_VER='cocos2d-1.0.0-x-0.9.0'
|
||||
COCOS2D_VER='cocos2d-1.0.1-x-0.9.1'
|
||||
BASE_TEMPLATE_DIR="/Library/Application Support/Developer/Shared/Xcode"
|
||||
BASE_TEMPLATE_USER_DIR="$HOME/Library/Application Support/Developer/Shared/Xcode"
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ HelloWorld::HelloWorld()
|
|||
|
||||
//Set up sprite
|
||||
|
||||
CCSpriteBatchNode *mgr = CCSpriteBatchNode::spriteSheetWithFile("blocks.png", 150);
|
||||
CCSpriteBatchNode *mgr = CCSpriteBatchNode::batchNodeWithFile("blocks.png", 150);
|
||||
addChild(mgr, 0, kTagSpriteManager);
|
||||
|
||||
addNewSpriteWithCoords( CCPointMake(screenSize.width/2, screenSize.height/2) );
|
||||
|
@ -130,7 +130,8 @@ void HelloWorld::addNewSpriteWithCoords(CCPoint p)
|
|||
//just randomly picking one of the images
|
||||
int idx = (CCRANDOM_0_1() > .5 ? 0:1);
|
||||
int idy = (CCRANDOM_0_1() > .5 ? 0:1);
|
||||
CCSprite *sprite = sheet->createSpriteWithRect( CCRectMake(32 * idx,32 * idy,32,32));
|
||||
|
||||
CCSprite *sprite = CCSprite::spriteWithBatchNode(sheet, CCRectMake(32 * idx,32 * idy,32,32));
|
||||
sheet->addChild(sprite);
|
||||
|
||||
sprite->setPosition( CCPointMake( p.x, p.y) );
|
||||
|
|
1
template/xcode4/cocos2dx_lua.xctemplate/Resources/background.mp3.REMOVED.git-id
vendored
Normal file
1
template/xcode4/cocos2dx_lua.xctemplate/Resources/background.mp3.REMOVED.git-id
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
aec1c0a8c8068377fddca5ddd32084d8c3c3c419
|
|
@ -24,17 +24,17 @@ function btnTouchMove(e)
|
|||
local v = e[1]
|
||||
local pointMove = v:locationInView(v:view())
|
||||
pointMove = cocos2d.CCDirector:sharedDirector():convertToGL(pointMove)
|
||||
local positionCurrent = layerFarm.__CCNode__:getPosition()
|
||||
layerFarm.__CCNode__:setPosition(cocos2d.CCPoint(positionCurrent.x + pointMove.x - pointBegin.x, positionCurrent.y + pointMove.y - pointBegin.y))
|
||||
local positionCurrent = layerFarm:getPosition()
|
||||
layerFarm:setPosition(cocos2d.CCPoint(positionCurrent.x + pointMove.x - pointBegin.x, positionCurrent.y + pointMove.y - pointBegin.y))
|
||||
pointBegin = pointMove
|
||||
end
|
||||
end
|
||||
|
||||
function btnTouchBegin(e)
|
||||
cocos2d.CCLuaLog("btnTouchBegin")
|
||||
for k,v in ipairs(e) do
|
||||
pointBegin = v:locationInView(v:view())
|
||||
pointBegin = cocos2d.CCDirector:sharedDirector():convertToGL(pointBegin)
|
||||
cocos2d.CCLuaLog("btnTouchBegin, x= %d, y = %d", pointBegin.x, pointBegin.y)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -91,7 +91,7 @@ animFrames = cocos2d.CCMutableArray_CCSpriteFrame__:new(2)
|
|||
animFrames:addObject(frame0)
|
||||
animFrames:addObject(frame1)
|
||||
|
||||
animation = cocos2d.CCAnimation:animationWithName("wait", 0.5, animFrames)
|
||||
animation = cocos2d.CCAnimation:animationWithFrames(animFrames, 0.5)
|
||||
|
||||
animate = cocos2d.CCAnimate:actionWithAnimation(animation, false);
|
||||
spriteDog:runAction(cocos2d.CCRepeatForever:actionWithAction(animate))
|
||||
|
@ -100,6 +100,8 @@ spriteDog:runAction(cocos2d.CCRepeatForever:actionWithAction(animate))
|
|||
-- add a popup menu
|
||||
|
||||
function menuCallbackClosePopup()
|
||||
-- stop test sound effect
|
||||
CocosDenshion.SimpleAudioEngine:sharedEngine():stopEffect(effectID)
|
||||
menuPopup:setIsVisible(false)
|
||||
end
|
||||
|
||||
|
@ -114,6 +116,9 @@ layerMenu:addChild(menuPopup)
|
|||
-- add the left-bottom "tools" menu to invoke menuPopup
|
||||
|
||||
function menuCallbackOpenPopup()
|
||||
-- loop test sound effect
|
||||
-- NOTE: effectID is global, so it can be used to stop
|
||||
effectID = CocosDenshion.SimpleAudioEngine:sharedEngine():playEffect("effect1.wav")
|
||||
menuPopup:setIsVisible(true)
|
||||
end
|
||||
|
||||
|
@ -142,5 +147,7 @@ end
|
|||
cocos2d.CCScheduler:sharedScheduler():scheduleScriptFunc("tick", 0.01, false)
|
||||
|
||||
-- run
|
||||
-- play background music
|
||||
CocosDenshion.SimpleAudioEngine:sharedEngine():playBackgroundMusic("background.mp3", true);
|
||||
|
||||
cocos2d.CCDirector:sharedDirector():runWithScene(sceneGame)
|
||||
|
|
Loading…
Reference in New Issue