Learning To Code

Hi All

I’m sure this has been asked a million times but I thought I would ask again. I’ve been a PHP programmer for around 10 years and now want to get into writing games. I’ve read a few books and tutorials etc but am still struggling to move forward.

I know from my own PHP coding that I know what to pull to put together to make a working program to perform a task, I’m guessing its exactly the same with lua.

Anyone got any thoughts I want they did in the early days to make the jump to being able to think of an idea and turn it into actual code.

Cheers

Steve

I’m an old C/PHP programmer, and I made the leap pretty easily.  Of course I also grew up on BASIC so using the Lua language was pretty easy.  Lua lets you get a way with plenty of C/PHP habits.  You can end your lines with semi-colons.  You can put parens around your tests for IF, WHILE, etc. even though they are not required.  You will need to break your $ habit and know to replace the curly braces with THENs and END’s

When working with tables/arrays you can use your familiar array syntax for associative arrays:

   

     data[“name”] = name

or you can use dot syntax too:

     data.name = name

Probably the biggest thing is learning how the event model works.  Unlike a PHP script which is typically started, runs then ends and the webserver cleans up for you, with Corona SDK and Lua, you are going to have a program that potentially runs for a long time but it runs without looping.  Your program’s main program ends, but the object you created hangs around and Corona handles running the loop.  You have to program your app to handle various events like touch and such and then react when the events happen. 

Thanks Rob

the $'s  are still coming through! guess it will take a while!

As someone who used other languages before using PHP, can I just say that I hate having to type $, I forget it every time.

Back to your original question, I had mainly used C++ and Obj C before using Lua. Someone directed me to a great series of tutorial videos on YouTube:

http://www.youtube.com/user/cheetomoskeeto

I would also say that and Rob Miracle and Brent Sorrentino have written loads of really helpful tutorials too:

http://www.coronalabs.com/blog/topics/tutorials/

Lastly, the forum has a pretty active community, so there are always people to answer any questions you may have. I try to answer a few questions a day, and there are plenty of other active users who I’m sure do the same.

Given that you already have programming experience, I’m sure you’ll pick it up pretty quickly.

Lua is a lot more ‘forgiving’ than a lot of other languages in my opinion (no need for semi colons if you don’t want them, don’t need to set the variable type etc), which is great for beginners. However this does mean that it is easier to create your own problems, such as redefining a number variable into a bool or something.

I’m an old C/PHP programmer, and I made the leap pretty easily.  Of course I also grew up on BASIC so using the Lua language was pretty easy.  Lua lets you get a way with plenty of C/PHP habits.  You can end your lines with semi-colons.  You can put parens around your tests for IF, WHILE, etc. even though they are not required.  You will need to break your $ habit and know to replace the curly braces with THENs and END’s

When working with tables/arrays you can use your familiar array syntax for associative arrays:

   

     data[“name”] = name

or you can use dot syntax too:

     data.name = name

Probably the biggest thing is learning how the event model works.  Unlike a PHP script which is typically started, runs then ends and the webserver cleans up for you, with Corona SDK and Lua, you are going to have a program that potentially runs for a long time but it runs without looping.  Your program’s main program ends, but the object you created hangs around and Corona handles running the loop.  You have to program your app to handle various events like touch and such and then react when the events happen. 

Thanks Rob

the $'s  are still coming through! guess it will take a while!

As someone who used other languages before using PHP, can I just say that I hate having to type $, I forget it every time.

Back to your original question, I had mainly used C++ and Obj C before using Lua. Someone directed me to a great series of tutorial videos on YouTube:

http://www.youtube.com/user/cheetomoskeeto

I would also say that and Rob Miracle and Brent Sorrentino have written loads of really helpful tutorials too:

http://www.coronalabs.com/blog/topics/tutorials/

Lastly, the forum has a pretty active community, so there are always people to answer any questions you may have. I try to answer a few questions a day, and there are plenty of other active users who I’m sure do the same.

Given that you already have programming experience, I’m sure you’ll pick it up pretty quickly.

Lua is a lot more ‘forgiving’ than a lot of other languages in my opinion (no need for semi colons if you don’t want them, don’t need to set the variable type etc), which is great for beginners. However this does mean that it is easier to create your own problems, such as redefining a number variable into a bool or something.