Talk about the difference between quick-cocos2d-x and Cocos2d-x Lua

Source: Internet
Author: User
Tags addchild lua

Before I say this, I still distinguish this two noun, after all, too long, the back of the fight is certainly troublesome, quick-cocos2d-x for short, quick,cocos2d-x Lua called the native Lua.


I think for the first time contact these two of the small partners must be more or less confused with me, these two are using two different APIs. I can only say the right half, indeed, Quick has its own API, but Qucik's set of APIs is re-encapsulated on native Lua, so quick still supports native LUA APIs.


Remember the first time you opened the Quick homepage, when you were not touched by a takeover, you see the headline-"This is a community that is interested in improving the efficiency of cocos2d-x development", yes, but how can it be called quick if not raised? Another time to look at their talent recruitment, one is so written-"there is a strong impulse to let others be developed by their own tools moved to cry," haha, it is now slowly feel is a bit moved to cry, some of the API provided is indeed a lot of convenience.


Let's take a simple example, or show the background image in the classic Helloworldscene, if we use native Lua in quick, it's the same as using C + +.

[plain] view plain copy print? function Mainscene:ctor () Self.size = Ccdirector:shareddirector (): getwinsize () Local SP = Ccsprite:create (" Helloworld.png ") sp:setposition (CCP (SELF.SIZE.WIDTH/2, SELF.SIZE.HEIGHT/2)) Self:addchild (SP) end

function Mainscene:ctor ()
    self.size = Ccdirector:shareddirector (): Getwinsize ()

    Local SP = Ccsprite:create (" Helloworld.png ")
    sp:setposition (CCP (SELF.SIZE.WIDTH/2, SELF.SIZE.HEIGHT/2))
    self:addchild (sp)

end

Need such statements to complete, but with the API provided by quick, so simple too much, really moved to cry

[plain] view plain copy print? function Mainscene:ctor () Local SP = Display.newsprite ("Helloworld.png", Display.cx, display.cy) self:addchild (SP) End

function Mainscene:ctor ()
    Local SP = Display.newsprite ("Helloworld.png", Display.cx, display.cy) self
    : AddChild (SP)

end

On these, is not too convenient, for the provision of coordinates greatly simplifies the demand, 32 likes.


Here's a quick way to learn, I think C + + that a set of methods to write games you master, for the LUA development game is not too big, after all, the corresponding function methods are some, the difficulty is how to use the way Lua write, such as a touch response event, If you write it in the form of quick, you need to take a good look at the API, of course, the online API provided by Quick is not quite complete, and some are not very detailed, so looking at sample is another way, quick provides a lot of sample, This is more important to us than any resource. Once you have mastered the basics, you can look at that coinflip, a complete example of the game, and I think it's almost possible to develop the game with quick.


That's all I want to say, and there's time to share some of your quick learning notes.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.