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'
|
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_DIR="/Library/Application Support/Developer/Shared/Xcode"
|
||||||
BASE_TEMPLATE_USER_DIR="$HOME/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
|
//Set up sprite
|
||||||
|
|
||||||
CCSpriteBatchNode *mgr = CCSpriteBatchNode::spriteSheetWithFile("blocks.png", 150);
|
CCSpriteBatchNode *mgr = CCSpriteBatchNode::batchNodeWithFile("blocks.png", 150);
|
||||||
addChild(mgr, 0, kTagSpriteManager);
|
addChild(mgr, 0, kTagSpriteManager);
|
||||||
|
|
||||||
addNewSpriteWithCoords( CCPointMake(screenSize.width/2, screenSize.height/2) );
|
addNewSpriteWithCoords( CCPointMake(screenSize.width/2, screenSize.height/2) );
|
||||||
|
@ -130,7 +130,8 @@ void HelloWorld::addNewSpriteWithCoords(CCPoint p)
|
||||||
//just randomly picking one of the images
|
//just randomly picking one of the images
|
||||||
int idx = (CCRANDOM_0_1() > .5 ? 0:1);
|
int idx = (CCRANDOM_0_1() > .5 ? 0:1);
|
||||||
int idy = (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);
|
sheet->addChild(sprite);
|
||||||
|
|
||||||
sprite->setPosition( CCPointMake( p.x, p.y) );
|
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 v = e[1]
|
||||||
local pointMove = v:locationInView(v:view())
|
local pointMove = v:locationInView(v:view())
|
||||||
pointMove = cocos2d.CCDirector:sharedDirector():convertToGL(pointMove)
|
pointMove = cocos2d.CCDirector:sharedDirector():convertToGL(pointMove)
|
||||||
local positionCurrent = layerFarm.__CCNode__:getPosition()
|
local positionCurrent = layerFarm:getPosition()
|
||||||
layerFarm.__CCNode__:setPosition(cocos2d.CCPoint(positionCurrent.x + pointMove.x - pointBegin.x, positionCurrent.y + pointMove.y - pointBegin.y))
|
layerFarm:setPosition(cocos2d.CCPoint(positionCurrent.x + pointMove.x - pointBegin.x, positionCurrent.y + pointMove.y - pointBegin.y))
|
||||||
pointBegin = pointMove
|
pointBegin = pointMove
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function btnTouchBegin(e)
|
function btnTouchBegin(e)
|
||||||
|
cocos2d.CCLuaLog("btnTouchBegin")
|
||||||
for k,v in ipairs(e) do
|
for k,v in ipairs(e) do
|
||||||
pointBegin = v:locationInView(v:view())
|
pointBegin = v:locationInView(v:view())
|
||||||
pointBegin = cocos2d.CCDirector:sharedDirector():convertToGL(pointBegin)
|
pointBegin = cocos2d.CCDirector:sharedDirector():convertToGL(pointBegin)
|
||||||
cocos2d.CCLuaLog("btnTouchBegin, x= %d, y = %d", pointBegin.x, pointBegin.y)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ animFrames = cocos2d.CCMutableArray_CCSpriteFrame__:new(2)
|
||||||
animFrames:addObject(frame0)
|
animFrames:addObject(frame0)
|
||||||
animFrames:addObject(frame1)
|
animFrames:addObject(frame1)
|
||||||
|
|
||||||
animation = cocos2d.CCAnimation:animationWithName("wait", 0.5, animFrames)
|
animation = cocos2d.CCAnimation:animationWithFrames(animFrames, 0.5)
|
||||||
|
|
||||||
animate = cocos2d.CCAnimate:actionWithAnimation(animation, false);
|
animate = cocos2d.CCAnimate:actionWithAnimation(animation, false);
|
||||||
spriteDog:runAction(cocos2d.CCRepeatForever:actionWithAction(animate))
|
spriteDog:runAction(cocos2d.CCRepeatForever:actionWithAction(animate))
|
||||||
|
@ -100,6 +100,8 @@ spriteDog:runAction(cocos2d.CCRepeatForever:actionWithAction(animate))
|
||||||
-- add a popup menu
|
-- add a popup menu
|
||||||
|
|
||||||
function menuCallbackClosePopup()
|
function menuCallbackClosePopup()
|
||||||
|
-- stop test sound effect
|
||||||
|
CocosDenshion.SimpleAudioEngine:sharedEngine():stopEffect(effectID)
|
||||||
menuPopup:setIsVisible(false)
|
menuPopup:setIsVisible(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -114,6 +116,9 @@ layerMenu:addChild(menuPopup)
|
||||||
-- add the left-bottom "tools" menu to invoke menuPopup
|
-- add the left-bottom "tools" menu to invoke menuPopup
|
||||||
|
|
||||||
function menuCallbackOpenPopup()
|
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)
|
menuPopup:setIsVisible(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -142,5 +147,7 @@ end
|
||||||
cocos2d.CCScheduler:sharedScheduler():scheduleScriptFunc("tick", 0.01, false)
|
cocos2d.CCScheduler:sharedScheduler():scheduleScriptFunc("tick", 0.01, false)
|
||||||
|
|
||||||
-- run
|
-- run
|
||||||
|
-- play background music
|
||||||
|
CocosDenshion.SimpleAudioEngine:sharedEngine():playBackgroundMusic("background.mp3", true);
|
||||||
|
|
||||||
cocos2d.CCDirector:sharedDirector():runWithScene(sceneGame)
|
cocos2d.CCDirector:sharedDirector():runWithScene(sceneGame)
|
||||||
|
|
Loading…
Reference in New Issue