最近开始学习Lua这里记录下一个写简单Lua代码,但我在写Lua代码。自己主动的代码提示的一些问题,谁希望提供下很好的解决方案,编辑我用SubLime Text2
test.lua。这里创建一个场景,一个层 ,一个Label 将test.lua换到HelloWorld 中的main.lua就好
//// Created by 杜甲 on 14-3-10.// Copyright (c) 2014年 杜甲. All rights reserved.//require "Cocos2d"require "Cocos2dConstants"require "Opengl"require "OpenglConstants"require "StudioConstants"require "GuiConstants"local scene = cc.Scene:create()local layer = cc.Layer:create()local label1 = cc.Label:createWithBMFont("res/fonts/bitmapFontTest2.fnt", "Test")label1:setAnchorPoint( cc.p(0,0) )layer:addChild(label1,0,1)local fade = cc.FadeOut:create(1.0)local fade_in = fade:reverse()local seq = cc.Sequence:create(fade,fade_in)local repeatAction = cc.RepeatForever:create(seq)label1:runAction(repeatAction)scene:addChild(layer)cc.Director:getInstance():runWithScene(scene)效果:
版权声明:本文博客原创文章,博客,未经同意,不得转载。