1. Load node to scene
The first of these methods
Local scene = cc. Csloader:createnode ("SCENE.CSB")
Self:addchild (Scene)
The second method of
Local scene = Cc.uiloader:load ("MAINSCENE.CSB"): AddTo (self)
2. Strong Turn Wizard Type
Local Sprite = Tolua.cast (object, "CC.") Sprite ")
Cocostudio do the inside of the wizard is Ccsprite (c + +) type can not use SetPosition and some other methods in Lua need to use Tolua.cast (Object,type) for casting type
3. How to use the button differently
Local BTN = Scene:getchildbyname ("button_1")
Btn:addtoucheventlistener (function (Event,type)
if type = = Ccui. Toucheventtype.began Then
Print ("began")
End
if type = = Ccui. Toucheventtype.ended Then
Print ("ended")
End
End
4. Animation (play timeline)
Local timeline = cc. Csloader:createtimeline ("MAINSCENE.CSB");
Scene:runaction (timeline);
Timeline:gotoframeandplay (0,true);
Timeline:setframeeventcallfunc (function (DT)
Print (Dt:getevent ())--frame event
End
This article is from the "10647504" blog, please be sure to keep this source http://10657504.blog.51cto.com/10647504/1714469
. csb files exported using Cocostudio in Lua