尊重版权,仅为个人使用,转载自:http://blog.csdn.net/w18767104183/article/details/21177589
最基本的层
最基本的场景
最基本的精灵
最基本的定时器
localfunctiontick() end cc.Director:getInstance():getScheduler():scheduleScriptFunc(tick,false)
最基本的触摸事件
最基本的音乐 --localbgMusicPath=CCfileUtils:getInstance():fullPathForfilename("background.ogg") localbgMusicPath=cc.fileUtils:getInstance():fullPathForfilename("background.mp3") cc.SimpleAudioEngine:getInstance():playMusic(bgMusicPath,true) localeffectPath=cc.fileUtils:getInstance():fullPathForfilename("effect1.wav") cc.SimpleAudioEngine:getInstance():preloadEffect(effectPath) localfunctionmenuCallbackOpenPopup() --looptestsoundeffect effectID=cc.SimpleAudioEngine:getInstance():playEffect(effectPath) menuPopup:setVisible(true) 最基本的加载图片 cc.Director:getInstance():getTextureCache():addImageAsync("DartBlood.png",imageLoaded) localtexture0=cc.Director:getInstance():getTextureCache():addImage("Images/grossini_dance_atlas.png") functionLoadingScene.imageLoaded(pObj) --body cc.Director:getInstance():getTextureCache():removeTextureForKey("Images/grossinis_sister1-testAlpha.png") cc.Director:getInstance():getTextureCache():removeAllTextures() cc.Director:getInstance():getTextureCache():removeUnusedTextures() localcache=cc.SpriteFrameCache:getInstance() cache:addSpriteFrames("animations/grossini_gray.pList","animations/grossini_gray.png") SpriteFrameTest.m_pSprite1=cc.Sprite:createWithSpriteFramename("grossini_dance_01.png")
最基础的动作
localfunctionCallFucnCallback1() localaction=cc.Sequence:create( cc.MoveBy:create(2,cc.p(200,0)), cc.CallFunc:create(CallFucnCallback1)) grossini:runAction(action)
最基础的字符格式化
string.format("grossini_dance_%02d.png",j+1)
最基础的按钮
localstart=cc.Sprite:createWithSpriteFramename("start.png") localstartItem=cc.MenuItemSprite:create(start,start,start) localfunctionmenuCallback(sender) cclog("menuCallback...") --tolua.cast(ret:getParent(),"cc.LayerMultiplex"):switchTo(1) startItem:registerScriptTapHandler(menuCallback) startItem:setposition(50,50) localmenu=cc.Menu:create() menu:addChild(startItem) menu:setposition(0,0) layer:addChild(menu) 总结
以上是内存溢出为你收集整理的初学cocos2dx lua 最基本的知识全部内容,希望文章能够帮你解决初学cocos2dx lua 最基本的知识所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)