![]() ![]() new(font, "Hello World!") - center to screen helloText:setPosition( application:getLogicalWidth()/2 - helloText:getWidth()/2, application:getLogicalHeight()/2 + helloText:getHeight()/2) - set text to red, color is hex encoding helloText:setTextColor(0xff0000) - display text stage:addChild(helloText) - function to handle touch event, move helloText to the touch location function onTouchHandler( event) helloText:setPosition( event.x - helloText:getWidth()/2, event.y + helloText:getHeight()/2) end - register touch function to respond to global touch events stage:addEventListener( Event.TOUCHES_BEGIN,onTouchHandler) - The above doesn 't work in the simulator, so handle mouse too stage:addEventListener( Event.MOUSE_DOWN,onTouchHandler) LÖVE ![]() new( "arial.ttf",72, false) - create text to display on screen local helloText = TextField. new( "Ride_of_the_Valkyries.mp3") - play audio file, looping forever local soundChannel = song:play(0,math.huge) - Set song volume to 50%, not set globally soundChannel:setVolume(0.5) - need to load a ttf font, size cannot specify character size in TextField local font = TTFont. a - Helloworld sample - setup our window to our 1280x800 resolution application:setLogicalDimensions(1280,800) application:setOrientation(Application.LANDSCAPE_LEFT) - Load song, cannot use relative path to parent directory since file needs to be added to project local song = Sound. That is why some versions have two lua files, while others have only one.Ĭa - a application = ) - create text to display on screen in 72point font local helloText = display.newText( "Hello World!",0,0,native.systemFont,72) - center to screen helloText.x = ntentWidth/2 helloText.y = ntentHeight/2 - red helloText:setTextColor(255,0,0) - function to handle touch event, move helloText to the touch location function onTouchHandler( event) helloText.x = event.x helloText.y = event.y end - register touch function to respond to global touch events Runtime:addEventListener( "touch",onTouchHandler) Some files handle window creation in a different file, some handle it in a single file. Then we are going to create a Hello World text/graphic centered to the screen, and position it where ever the user clicks/touches. In this sample we are going to create a window at a resolution of 1280×800, then we are going to start a background song looping ( Richard Wagners – Ride of the Valkyrie taken from here ). If you wish to submit a better rendition, please do so! I do not pretend mastery of any of these suites, or Lua in general, so take the code for what it’s worth. Now we are going to look at a simple Hello World app written with each suite. * Note, I gave iTunes link only, although many of those games are also available on Google Play. Paid cloud computing offering for back-end services IOS Android Windows Mac Linux (in late stage development) Chrome NacLīuilds occur on Corona Labs servers, internet connection required 3rd party tools available Enterprise version available ![]() IOS Android (Mac and Windows under development) Mandatory splash screen Pro required if income greater than 100K$ Hopefully this will help you decide which engine is right for you.ġ99$ /year iOS 199$ /year Android 349$ /year Both Free trial availableġ49$ /year Indie 449$ /year Pro 0$ /year CommunityĬannot publish to app store with free version Then we will follow up with a simple Hello World example for each, so you can see what the code would look like. First there will be a matrix of features, to give you an “at a glance” view of what each engine offers. ![]() Alright, the title might be a bit over the top… what we are about to do is look at some of the most popular 2D game engines powered by Lua. ![]()
0 Comments
Leave a Reply. |