Does learning LUA LANGUAGE helps Corona programming?

Hello

I am a person from non technical background; I’m interested in CORONA SDK so I started to learn it through video tutorials and documentation for about 2 months.

However, I still find it very difficult. It’s still very hard to imagine how exactly a game is made. There is almost no book available out there for Corona because it’s new.

I wonder if I find some Lua Language book to read, does it help? Anyway Corona SDK is based on Lua. Maybe there are more books for Lua language out there.
Right now I have “Programming in Lua” 2nd Edition. Any comments or suggestion?

Thanks [import]uid: 54857 topic_id: 12851 reply_id: 312851[/import]

Yes, you need to learn Lua, but more importantly you need to learn programming in general.

Corona SDK isn’t a language, its a combination of API (Application Programming Interface) and Tools that let you use the Lua language to do things with the API and in the end produce an application.

For instance, Lua doesn’t know how to load an image on the screen and move it (well you probably could with a lot of code), but the Corona SDK API lets you do it a few lines of Lua code.

As for how to make a complete game, there will be quite a few game developer books out there. None will be with Lua or Corona SDK, but you can learn what all goes into a game. With Borders going out of business, now would be a good time to stock up!

Now to get you started, most all games will have multiple screens like a menu screen, help, credits, high scores, etc. Get the “Director Class” from this site and use it to manage all of those screens. Basically you create a Lua file for each screen, link to them from the menu.lua file and volia, the PITA (Pain in the Ass) parts will be decently maintained.

Then you can focus on your game.lua (unless you’re doing different levels, in which case you will have multiple level1.lua level2.lua etc. files).

Once you are in your game code, you most likely will need something called a “Game Loop”. This is a loop that runs and does things like move your objects around, detect when things hit each other, and so on.

Corona SDK and Lua uses things called “events” to do this work for you and it has its own game loop that does a lot of this processing in the background. Lets say your building a game that uses physics. In code you don’t touch, they take care of moving your objects based on the physics affecting it. When things happen like when things bump into you, Corona will generate an event. You need to write code to do something when that event happens and register that code with the program. This is called adding an event listener.

Lets say your building the Tron motorcycle game where the bikes leave a wall of color behind them and the object is to trap the other bike. So when the Blue bike hits a color wall, an event is triggered. You write the code that says what happens when a bike hits a wall like maybe calling your game over code. You handle the event, tell the system you are done and life goes on.

Sometimes you need to have your own game loop and that’s done with a special event listener called “enterFrame” which fires every 1/30h of a second (or 1/60th depending on your set frame rate).

In my game OmniBlaster (http://bit.ly/omniblaster) I did not use physics, so I had to do my own detection to see when things hit each other. So I created a Lua function named “gameLoop” (very creative I know) and added it as my event listener for the “enterFrame” event, so 30 times a second that function gets called. In that function, I detect if any of my on screen objects are touching (Collision detection) and if they are, I do something about it (blow something up, give points or take away shields/lives depending on what hit what)

Maybe that will give you something to start on. [import]uid: 19626 topic_id: 12851 reply_id: 47148[/import]

Thanks for your great answer. Actually I talked to a programmer before and he told me the same thing:" You need to think like a programmer before become one"

I see the point that I should learn about general things in game development. So is there any book or documentation about this topic? For example: programming for dummies or…bla bla

Thanks

[import]uid: 54857 topic_id: 12851 reply_id: 47201[/import]

Actually there are!

http://www.dummies.com/store/product/Beginning-Programming-For-Dummies-4th-Edition.productCd-0470088702,navId-322467,descCd-description.html

http://www.dummies.com/store/product/Beginning-Flash-Game-Programming-For-Dummies.productCd-0764589628.html

are a couple of titles to start with. There are books for iPhone/iPad game development but those are going to use a language called Objective C and even with my near 30 years of programming experience, I need a for dummies book for Objective C. [import]uid: 19626 topic_id: 12851 reply_id: 47209[/import]

Those books are pretty old. Just sayin… :] [import]uid: 80988 topic_id: 12851 reply_id: 50639[/import]

As a (former?) non-programmer myself I feel your pain. One book that really helped me understand how to “think like a programmer” was “ActionScript 3.0 Game Programming University” by Gary Rosenzweig. I believe it’s now in a second edition.

Yes, it’s for ActionScript so it’s not going to help you learn lua or Corona SDK (although I find ActionScipt very similar to Corona’s lua scripting), but there is a lot of directly applicable wisdom in that book, especially if you want to make simple, casual type games. I would even suggest first reading it front to back without creating any of the sample games and see if that helps you better wrap your brain around Corona.

-Stephen [import]uid: 9422 topic_id: 12851 reply_id: 50663[/import]

i think if your not ready to learn the programming you better try .gamesalad … its very basic engine good for game designer who do not want to learn programming …

or you can use the stencylwork …its a flash engine for non programmers …

corona sdk is very good engine but i don’t think its that much easy even for good programers …
it do not have good documentation or book …

but if you really want to make professional good games or app i recommend that you spend sometime learning programming …

[import]uid: 34898 topic_id: 12851 reply_id: 50664[/import]

It took me a while to understand programming and stuff. Just keep at it and do what you’re doing now and all will become clear. Keep searching around for Lua/Corona tutorials on the web and YouTube.

The more tutorials you watch and read, the easier programming (and the book) will become. :smiley:
[import]uid: 80988 topic_id: 12851 reply_id: 50668[/import]

I want to develop application for enterprise level,for instance,a software for hotel in which a customer will navigated through tab(application software) for accessing the facilities available which i’m developing with the help of android which i find flexible for development but this same scenario i want to repeat for iphone i find corona SDK for cross platform development which uses Lua Scripting but its syntax is basically for game(as i saw)and i thing it will lead me to complexity in future while development so which one will be suitable language (which i can use)?
[import]uid: 108555 topic_id: 12851 reply_id: 73478[/import]

If you go look at the Showcase section, you’ll see there are apps of all genres http://developer.anscamobile.com/showcase/ [import]uid: 80988 topic_id: 12851 reply_id: 73486[/import]

@robmiracle
>> I need a for dummies book for Objective C.

Go cocos2d first and you will jump to Obj-C without much pain in ass :slight_smile: [import]uid: 12704 topic_id: 12851 reply_id: 73512[/import]