Sublime Text2 CoronaSDK Autocomplete

All CoronaSDK Api’s added. It all works fine but make sure you check out the README text for more info. I’ll add more Api when there’s new ones coming, this list include new Api from the daily builds too that may or may not change. Do always keep an eye on Ansca blog and daily builds for changes in Api.

Enjoy


Tweet&getit is powered by Viuu


Sublime Text2 Revisited…

The past few days I’ve been working on a real CoronaSDK autocomplete for Sublime Text2, though it’s quite time consuming to format all Corona API’s to JSON it’s getting along quite well.

In this bundle I have updated the Corona-Lua syntax with a few more keywords and included the new API’s from the Dailybuilds. There’s a build system added so on a Mac you would press cmd+B to launch the simulator. One little quirk I noticed is that it only works when you’re working on files located in the same directory as the main.lua so if you have a nice subfolder structure then you need to click on the main.lua file to launch the simulator. There’s probably a fix for that but I’ll deal with it later when all API’s are done.

One thing that is nice with this bundle is that it output the errors in the code (if you have any…) in the built in ST2 console just like it does in the corona terminal, however…..it does not handle print(). That is yet to figure out…..

So to install this you just drop the folder in the bundle directory and you’re good to go.

That’s all for now, I got +400 more Corona API’s to format into JSON…..

I’ll tweet when and where it’s ready for download.

See ya later.

How to install CoronaSDK TextMate autocomplete bundle in Sublime Text 2

Not too long ago I heard of Sublime Text 2 (Beta) and thought I’d give it a try. I’ve been a huge fan of TextMate and it’s been the no: 1 editor of my choice ever since I started working with CoronaSDK.

One thing I was missing in ST2 was the autocomplete for CoronaSDK API’s, after a little reading I learned that anything TextMate is compatible with ST2 and I thought I’d try to install it, it was to mu surprise really easy to do and here’s how it’s done.

  1. Go to Github and download the files.
  2. Open the folder called Snippets, copy all it’s content.
  3. Open Sublime Text2, click on SublimeText2/Preferences/Brows Packages.
  4. Finder will open if you’re on a Mac, scroll down to the Lua folder and Paste what you copied earlier into that folder.
  5. Go back to the TextMate CoronaSDK bundle folder and copy the content in the Syntax folder and paste it in the same place as before.
  6. Copy the rest of the contents and paste that to.
  7. Restart Sublime Text
  8. Now you should have the same AutoComplete as in TextMate.

Now, there’s one error that might occur when you start ST2 but it does not affect the CoronaSDK bundle.

I have not tracked down what is causing this but I will updated this article when I know.

enjoy/

lano78@twitter

Create Pixel Art With Adobe illustrator

When creating art for your iphone or android app or game, the most common tool is Photoshop. However, since there are so many different devices and screen resolutions, creating graphics can get very time cosuming when you want to support as many types of devices as possible.

In this tutorial I will instead use Adobe illustrator to demonstrate how to create scalable pixel art for a 8bit type game. We will also have in mind the the power of 2 rule. For those of you who doesn’t know what that rule is, here’s a great tool for learning about unknown things to you…

Let’s get this party started…

1. Launch Adobe illustrator, if you don’t have it go to Adobes website and download a free trial.

2. Create a new canvas, File/New…

3. There’s nothing complicated here, just make sure you have a document setup like mine, name it tileSet then press OK button

.

The reason why we created a canvas with the 512x512px dimension is because of a few things;

- We could have made it smaller but assuming this is for a Tiled Map game, we will easily add many more items later to our tileSet as our project grows.

- Next reason is the power of 2 rule, I assume you have used that fantastic tool I linked to, here’s the link again…

Back to the tutorial.

4. Now that we have our document set up, theres pretty much two tools we will be using. First tool is the “Rectangular Grid Tool”  and the “Live Paint Bucket”.

5. Save your document before we go any further also make sure you save often to avoid any unpleasant situation…

6. With the “Rectangular Grid Tool”  selected, press once anywhere on the canvas and you’ll see this dialog. Make sure you have the same setup as me then click OK button.

We just created a 32x32px grid to use as our base for the first pixelArt item we will create. To be able to use this grid for our purpose we must first position it at the x = 0, y = 0. This step is just to make it a bit easier for us to align the item properly in out tileSet and eventually add the next item to the right.

7. Select the grid we created with the “Direct Selection Tool”  and set the Reference Point to Top Left Corner, change the x and y cordinates to 0 and press enter. 

8. If your grid looks like a black rectangle, it’s because you have a 1pt stroke applied to the grid. Let’s fix that, to make it easier to see our pixels in our grid we change the stroke width to 0.05pt. This will give us a very thin black outline and make it easier to see where we are painting our pixel art.

 

9 With the grid still selected, switch to the “Live Paint Bucket”  and place the cursor over the grid. It should now turn red, click on the once. The grid is now ready to use for pixel art.

10, Change to the “Direct Selection Tool”  and click once outside the grid to deselect the grid to make it easier to see what we are creating.

11. Change back to “Live Paint Bucket”  and pick any color you want to paint with. Zoom (cmd +) in on the grid as much as you like, I keep mine at 2400%.

12. In this tutorial I made a 1up mushroom from Super Mario, you can just google an image you like and open it with illustrator and keep it as a reference or you can use my image.

13. If you make a misstake when you paint you can’t use the “Eraser Tool” instead you should select color [None] in the swatches panel. This will let you erase any errors and if you don’t wanna bother with erasing you can just paint the pixel again with the color it was before.

14. Now that you are done with your pixel art, copy mine or drawn your own, you select the grid again with the “Direct Selection Tool”  and remove the stroke we added earlier. All you have now is the pixel art.

15. Save your project.

16. Now we’re ready to export our file as a png, File/Export…

17. As we already had our name tileSet you should keep it, in the format dropdown menu you’ll see a few different formats to save as. You can save as PSD if you want to edit the image in photoshop or for this example we will pick PNG. Save as .png and press Export.

18. Now you will see this dialog box , if it looks like mine press OK and now you are done.

Let’s say this was an sprite for older iOS devices and you wanted to add Retina support in your next update of your super cool game, now you just select your image in illustrator and double it’s height and width and you are done!

- Note.
Adobe illustrator trim any excess transparancy of your image so if you haven’t used the entire grid you’ll end up with a sprite that is not, in this case 32x32px.

This was the end of the tutorial, in the next we’ll create a tileMap with Tiled and render it on the iPhone using Corona SDK and Lime.

Resource file

First Look at CoronaSDK

Screen Coordinates, ReferencePoints and Groups

At this point you have decided you want to give CoronaSDK a fair try, you have it downloaded and installed on your computer and you have also looked at a few samples that came with the SDK.

If you haven’t yet had a chance to read through the various articles Ansca have to get you started I suggest you read through them before you continue reading this article.

In this series of tutorials I will not have the same approach as others have, we will not write a bunch of “Hello World” apps before we get started, I will instead explain what  things are and do when we get there.

First a couple of important things, if you are one of them who didn’t ever think you would need the math classes you took in school. You’re wrong, math is used all the time in development and like me who wasn’t a huge fan of math I had and still have quite a struggle with some of it at times……math sucks….

A  few other important things to know about is how and where to position your objects on the screen, if you don’t want to have any unexpected results  then pay attention to the following.

Screen Coordinates

All screens are based on the X and Y system where X is the Width and Y is the Height. On all devices the top left corner of the screen is X = 0 and Y = 0. In for instance the iPhone/iPod/iPad who can rotate to depending on how you are holding the device the top left corner will always be 0. Take a look at the illustration below.

Reference Points 

A reference point is a specific position within the bounds of an object, an object can be an image, a text label, a webView, anything you can position on the screen is an object. The default referencePoint of an object is TopLeftReferencePoint which means the top left corner of the object.

  • CenterReferencePoint
  • TopLeftReferencePoint
  • TopCenterReferencePoint
  • TopRightReferencePoint
  • CenterRightReferencePoint
  • BottomRightReferencePoint
  • BottomCenterReferencePoint
  • BottomLeftReferencePoint
  • CenterLeftReferencePoint

Groups

In Corona there is something called Groups, a group is a container or a box if you will that you can put objects inside. Groups are a very useful way to organize the layout of your app or game and you can position groups and assign a ReferencePoint the same way you do with objects. The default ReferencePoint for a Group is TopLeftReferencePoint, if you don’t tell Corona what ReferencePoint you want it will automatically assign that ReferencePoint. One important thing that most new developers get confused with is that when you position Groups you also re-positions the objects inside.

So if you have an object positioned in the middle of the screen with default ReferencePoint ( TopLeftReferencePoint ) and then you assign CenterReferencePoint to the Group that holds the object and position the group at X = 0, Y = 0. Your Object will then be at positioned visually in the top left corner of the screen. The object however will still have the position coordinates you assigned it to but only within the group. One thing to remember is that a Group is only as large as the content that is inside.

Example;

A group with two objects inside, a background and a rectangle. Background positioned at X = 0, Y = 0 and the Rectangle at X = 240, Y = 160. Both Objects with Default ReferencePoint. ( TopLeftReferencePoint ). The Group is then assigned CenterReferencePoint and positioned at X = 0, Y = 0.

The Result

Like I said before, this can cause some serious confusion to new developers if you don’t pay attention but if you keep this in mind you will be just fine.

This will wrap things up for this time, see you soon.

Tools you need.

The only thing you really need is the plain old text editor that ships with the computer, that’s it!!

However, the standard text editor will not likely support syntax coloring. Ok, stop what is syntax coloring? For those of you who are totally new to programming, syntax coloring is pretty much a way to make code easier to read by add different colors to different words.

So what tools should you use?

TextEditors

Well, over the time you learn programming you will most definitely try lot’s of tools. Let’s check out the Text Editors you can download for free and the ones that cost a little money. Here are 5 that I have tried and works great.

What editor you should use is a matter of preference, they are pretty much the same but different layout. Personally I use TextMate because there is a free plugin for syntax coloring and autocomplete words of coronaSDKs API’s and the creator also added some useful code snippets.

I have used all of them and I still have both BBEdit and Smultron on my Mac but I mostly use TextMate.

Corona Specific Tools

At first there was just one tool available but lately we’ve been getting more options and to this date there are three;

First off, Corona Project Manager ( CPM ). I use this tool the most for a few reasons, it’s great, built in syntax coloring, built in code editor, built in terminal for tracking code errors etc, it launches the corona simulator automatically and re-launches when you have made any changes to your code, you can drag and drop files into your projects, you can borrow assets from other projects, it has a code snippets library where you can add your snippets to. It’s very useful and manages your files, images and folders very nicely and it’s cross platform ( run on both mac an windows ). The only downside is that it’s a little pricy but in the longrun it’s is absolutely worth the money.

IndeED is a free tool and it does pretty much what Corona Project Manager does, unfortunately I have not used it as extensively as CPM but as I said over all it is pretty much the same thing. It has the built in editor, terminal, project file browser, simulator works just like in CPM. IndeED is a good option if you are on a budget.

Corona Commander is a brand new tool for mac users, also a competitor to CPM. This tool just got released and I haven’t had a chance to try it yet but from reading about it and looking at the photos in Mac Appstore I must say it looks nice and polished. Unfortunately, since I have not yet tried it I can’t say much more about it until I’ve had a thorough evaluation of the software.

Other tools

There are also other tools you can use for Corona development, if you have a mac then you can download Xcode for free from Mac Appstore which you will need later anyways when you get to the point of publishing your creations.

A second option is Coda,  I really like this mac app because it’s so versatile and it looks real good too. You can use Coda as an editor for almost any language, publish websites etc… There is a plugin for Lua syntax coloring too as well as a autocomplete plugin all in one. This plugin is also created by a corona user and is available for free. You can download Coda from mac Appstore but it’s the most expensive of all the tools I have covered in this article.

In the next article we’ll have a look at CoronaSDK and Check out the basics.

Thanks for now.

 

Choosing a platform(s)

Well this is pretty easy, what phone do you use? Android, iPhone?

So you have an Android but you use an iPod Touch, great.

You have an iPhone but you have an iPad too, Fantastic!

You’re so loaded with cash you have all kinds of phones and tablets laying around?…….donate button is to the right…..

Let’s get serious shall we,

Now, if you don’t have any of these devices that is fine too.

I’m an iPhone user and I’ve been one since they first came so for this series I will focus on that, however if you’re an Android fan this doesn’t mean you can’t follow along in this tutorial too. Just stick around and I’ll show you…..

In this tutorial series we will be using CoronaSDK, the reasons for that are many but to cover a few;

  1. Cross platform.
  2. It uses Lua, an easy to learn scripting language.
  3. Great community and lot’s of helpful users.
  4. Box2d Physics engine built in.
  5. Daily updates and bugfixes.

Now that we have got that covered, get a trial version of CoronaSDK here.

In my first point above, Cross platform, that is just not that it runs on both mac and windows but it also run on both iOS and Android! Think about that, Write your app or game once, publish for both iOS and Android. Right there you just cut your development time in half and you could possibly make double the money on your super cool app too!

Sorry, I hate to break it to ya…..just because you have made a super cool app doesn’t mean it’s a way to instant wealth. There are hudred of thousands of really cool apps and games in both appstore and android market so to break it into the top you need lot’s of marketing but I wont go into that in this article.

Lua, some may say read this and that book before you start with CoronaSDK. I say, don’t read the books before, learn from doing, try modifying sample code, check out youtube for video tutorials. Keep the books as a reference for the times you are stuck or are getting more advanced in your Lua skills. These are my advices for beginners, check out this site for lot’s of articles on learning CoronaSDK.

Box2d, implementing realistic physics into a game can’t get any easier than this. If you don’t believe me check out the manual for box2d and I bet you’ll be back in the CoronaSDK API section within 2 minutes…..

Daily updates and bugfixes, the trial version you’ll be downloading is the latest stable version of CoronaSDK, if you have decided to purchase a subscription then you will have access to the “Daily builds” which includes new features, tweaks and of course bug fixes.

But to get on with it, now you made the smart choice of trying CoronaSDK. Head over to the forum and introduce yourself  and don’t be shy to ask for help but just one advice before you start asking lot’s of questions….search the forum and use google for any external articles that can help you.

So until next article, check out the samples provided with CoronaSDK, spend a few hours a day to read threads and check back here soon.

See ya.

 

Starting out.

When I first started iOS came as my first option, after doing some research and reading tons of books about learning Objective-C I always thought it was so complicated and not very user friendly language.

Like in most books I read, most titles were “Learn Objective-C”, “Objectiv-C for beginners”, “The ABC of Objective-C”. Ok, I made the last title up……

But in most of these books, even though the title clearly stated it was for beginners I soon learned after reading a few chapters that they assumed I already knew  C, C#, C++ etc but I didn’t.  So although I learned a lot I found myself in a struggle and every time I sat down to program, (this was before I started my company), I always though it had to be an easier way to do this!!

After about two years of digging into Obj-C, C and C++ in the weekends and evenings after my regular day job, I read that some developers were using a scripting language called Lua. I’ve heard about Lua before and that is very common in the game development industry but never that it could be used for iPhone apps. So I decided to look into what all that Lua fuzz was about using this fantastic tool and it soon lead me to this site.

So after I had found out about Ansca Mobile and their Corona SDK I downloaded their trial version but pretty soon I put that aside and continued my battle with Obj-C.

Before I decided to learn iPhone development I was mainly a HTML, Photoshop and illustrator guy and as I started my company after a few years in the event bizz I started getting request for making iPhone apps. But due to my vague Obj-C skills I had to decline work in that area and just make graphics.

Then about almost one year ago I noticed that Corona SDK had gotten some real good traction and things were actually looking pretty good. So I updated my SDK and started looking at the samples, reading the api’s, I found a few but not too many sites with tutorials, the forum seemed very active and the users were helpful.

I compared an app made in Obj-C with a similar one I created with CoronaSDK and Lua then it was obvious, 200 lines of code were cut down to just 20! The decision was clear, go with CoronaSDK and learn Lua. Thing’s were just so simple with Lua, even though it is based on C language it was nothing like it and man was I happy.

So now that I knew that using lua and CoronaSDK was not only cutting my development time, this also ment I could make more apps in the same time it take to write one app in Obj-C. As a business owner, time is money, so this was clearly the right choice for me.

So if you are reading this article, thinking about venture into app or game development…..save yourself some trouble and do it right from the start and try CoronaSDK first before you head over and get the headaches I got from my experiences…..

Note: I am not affiliated with Ansca Mobile nor do I receive any endorsement from them, I just  think their product is simply brilliant.

The New Start

Due to my little database failure a little while ago I manage to lose all my previous articles I had written. Although I wasn’t the most active writer I still had quite a few posts but despite losing my content I decided to start a little article series for the aspiring iphone or android developer.

This series will cover everything from tools, iOS, what to think about, creating your graphics, what kind of app or game to create, planning, 3rd-party SDKs, what devices do you need etc……

So for now, this is it.

The Failure.

Last week I had a little issue with my database for the site and my entire content got erased. Don’t ask me how….

So I made a clean database and start this site over and add some content with value, before it was just a blog but I intend to incorporate a portion of my company too and add my portfolio and past, current and future projects.