Corona SDK Hello World tutorial

January 27th, 2012 No Comments »

Hello, as most of you know, each first tutorial in a new language or program is the Hello World program.

First of all, support us by installing our free app : 3Rocks

Also in this tutorial I will guide you on downloading and installing Corona SDK and also creating your first script, this tutorial is created on a mac, but all the steps are the same for windows.

1. Go to this URL and enter your data, then download Corona SDK.

2. Go to the samples directory and duplicate one of the folders, i duplicated the sprites/junglescene folder, than rename the folder, i renamed mine to “empty project”.

3. Now go into the folder and delete some of the files, i selected the files which you need to delete :

4. We now need an “Hello World” image to use, you can use mine, save it in your project folder :

Right now you should have this files in your project directory :

5. If everything it’s ok, open the main.lua file and remove everything from it.

6. Add this (assuming that you saved the image i provided) :

local image = display.newImage(“h.jpg”);

7. Open the corona simulator, and navigate to your project, select the main.lua file and load it.

Success !!! is that easy !

Create a game, for the absolute beginner

January 20th, 2012 No Comments »

Hey, you, reader, ever wanted to create a great game, you had a brilliant game idea, but you ware unable to create it ? Well is both easy and complicated, if you have any programming experience than it’s really easy.

Here are some tools you may find very very use full :

Corona SDK -  create games for mobile platforms (iPhone, iPad, Android)

Love2d – Create games for desktop computer (windows, linux, osx)

Unity3D – Create 3D games for mobile and desktop, requires at least some average programming skills and game concepts knowledge.

With both of those you can create 2d games very easy, both of them use LUA scripting language, it’s very easy to learn and understand.

Usually in a game project there are 3 types of people involved :

  • game designer – creates the game idea and concepts, usually he is also the team leader
  • asset designer – creates all the graphics needed by the game
  • programmer – actually creates the game

If you are really good and passionate you can play all the 3 roles, but you have to be aware that all of those take a lot of time.

Take a look at may newest game : 3Rocks for Android it’s built with CoronaSDK and will soon be published for iPhone too.

If you have a great game idea and you are not able to create it, please don’t hesitate to send me an email, you can find my address on the about section of the app 3Rocks for Android.

I’ll soon start to post some tutorials about mobile games development with CoronaSDK and Unity3d so… bookmark my blog or subscribe to the RSS to make sure you don’t miss them

iPhone speed gauge, compas or clock component

May 20th, 2011 No Comments »

Hi there, this is a tutorial, with full source code and a functional example of how to create a round gauge or clock component for iPhone.

This tutorial is very useful because it also shows you the principles and the best practices to create a custom component.

This tutorial will show you how to create an animated gauge just like this :

The final gauge

The final gauge

The component we create can be skied with any images you want, it can be a speed gauge, a compass or anything you want, it will be auto scalable and one line integration.

The principle it’s simple, we just extend the view and in it we add our code to create the gauge, in this case the gauge is very simple, it only has a background image and a pin which you can rotate to a specific angle in degrees.

So, here goes :

1. Download the files located here, this is the View subclass i created and the images needed for the project, both high and low resolution.

2. Create a view based project, this is the easiest solution for exemplification. My project is called “Gauge” so all the names of the view controllers will be relative to this, it would be easier for you if you name your project the same.

Create a new view based project

Create a new view based project

3. Add the files to the project (check the copy to project option)

Add the files to the project

Add the files to the project

and this how the project structure will look like when you are done (i created a separate images directory, so the tree looks cleaner) :

Xcode project structure

Xcode project structure

4. We should create an outlet for a ClockView, which we will add in the project. In this example I will only use one gauge, but you can follow the process to create as may as you want.
Now open the “GaugeViewController.h” file and change it so it looks like this :

#import

@class ClockView;

@interface GaugeViewController : UIViewController {

  ClockView *gauge1_;
}

@property(nonatomic, retain) IBOutlet ClockView *gauge1;

@end

What we did here is to add a forward declaration for the ClockView and declare an outlet to a ClockView view, remember that ClockView is a subclass of UIView, so it can be used in any way a view can be used. Now open the “GaugeViewController.m” and add the code bellow right after the “@implementation GaugeViewController” line :

@synthesize gauge1 = gauge1_;

and also this is how dealloc method should look now :

- (void)dealloc
{
  [gauge1_ release];
    [super dealloc];
}

5.Now open the “GaugeViewController.xib” file, here we add our clock view. We add it as a normal UIView, so you should add a view from the library to your main view (as a child of the main view), the view you add should be square :

Add a new subview

Add a new subview

6. We have to set the new view to be a clock view, we do this by changing the class of the view we added from UIView to ClockView :

Change the class of the UIView

Change the class of the UIView

And also set the outlet of the view to the outlet we created earlier :

set the outlet

set the outlet

And we are done with the xib file, save it!

7. Open once again the “GaugeViewController.m” file. Include the ClockView.h file. Update the viewDidLoad method, which should look like the one bellow :

- (void)viewDidLoad
{
    [super viewDidLoad];
  [gauge1_ prepare];
}

8. We are almost done, one more small thing remaining. The ClockView uses some layer methods to transform it, and those methods are found in Quartz2d frame work, so we have to add it. So add the Quartz2D framework :

add quartz2d framework into the project

add quartz2d framework into the project

9. Build and run the project :D :

Run the clock view project

Run the clock view project

The pin of the gauge is very easy to rotate, by calling the rotateTo method of the clock view.

As an extra bonus step, let’s make the clock to make an full rotation every minute, and update it every second. We will do this by adding a timer to the project, and an integer to count the seconds.

Open the “GaugeViewController.h” and change it to :

#import

@class ClockView;

@interface GaugeViewController : UIViewController {

  ClockView *gauge1_;
  NSInteger seconds_;
}

@property(nonatomic, retain) IBOutlet ClockView *gauge1;

@end

All I did was to add a new NSInteger variable.

Now open the GaugeViewController.m and add a timer and a method which is called every second :

- (void)viewDidLoad
{
    [super viewDidLoad];
  [gauge1_ prepare];
  [NSTimer scheduledTimerWithTimeInterval:1.0f
                                   target:self
                                 selector:@selector(secondUpdate:)
                                 userInfo:nil
                                  repeats:YES];
}

-(void)secondUpdate:(NSTimer*)timer {
  //we have 360 degrees on a full rotation, and we want 60 steps per rotation
  [gauge1_ rotateTo:seconds_*(360/60)];
  seconds_++;
}

Run the project once again and observe the results.

Here is the entire project if you want it.

The iPhone AI engine now with cocos2D

April 1st, 2011 No Comments »

Now, i created the AI engine to be very scalable and easy to use, as a demo, i tried to create a cocos2d project and add the engine, the experiment was a epic success, it took me around 10 minutes to integrate the engine into the app.

Here is the demo video, unfortunate when recording from the simulator it’s working at a very low frame rate, but the app runs very good at 60fps with 75 characters (with seek, crowd, obstacle avoidance)

I also changed the control for the game…. it’s now at version 4 :)

Enjoy the video and let me know if you have any questions.

Memory And IQ game for iPhone

March 31st, 2011 No Comments »

A while ago i was thinking about creating an memory application for iPhone, but i had no idea how to make it unique… until now !!!

The app it’s now live on iTunes, you can download and test it for free, or you can download the full version for just 1$.

Get it now for free, and spread the joy !

Some of the cool features for the game are :

  • 8 difficulty categories
  • up to 500 levels to complete
  • online global scores
  • statistics for each shape
  • easy to use and intuitive interface
  • new levels added periodically

Here is a short demo video for the app :

If you have any comments for the game let me know and I will answer them for sure!

Artificial Intelligence Engine for iPhone Games

March 22nd, 2011 No Comments »

A while ago I started an simple zombie game, called James Bond In The Zombie Invasion, for this I needed an AI engine, to manage the zombies, it needed to be very easy to use and very fast.

It’s now at version 2 and it’s very very fast, has some built in behaviors, seek, crowding, obstacle avoidance and the list is growing by the day.

This version of the engine is written in pure C so will run on any platform, mobile or desktop, it can even be compiled for micro controllers.

So, here is the demo video for the engine, the engine is for sale, and the price depends on every one (no less than $10 an no more that 99$) :

This is it, if you want a copy of the engine (and the demo project let me know).

Fireworks simulation on iPhone

December 3rd, 2010 1 Comment »

A while ago, i created a pretty basic particle system to create some fireworks, recently i did some changes, and created a simple demo application for the system.

Here is a demo :

Also i’ll add the source code here, asap. Mean while take a look and admire the view ;) .

Fireworks source code – here is a zip with the source code, have fun playing with it, and remember to give me the credits if you use it in your projects ;) .

The “Bancuri” iPhone application

November 25th, 2010 No Comments »

A while ago I got a great idea, to create a jokes application for iphone (Bancuri is the Romanian word for jokes), and this application become e reality, on 6 November, it was a hit, was #1 on all categories for 3 days, and it’s still one of the top 20 most downloaded applications in the Romania store.

Bancuri for iPhone

Bancuri for iPhone

Here it’s the link :

http://itunes.apple.com/ro/app/bancuri/id400248638

This post will also be the support link at the first update, so please let me know if you have any comments, or ideas about the application.

Here is a video with what the first update will bring up ;)

3d games with unity

September 24th, 2010 No Comments »

I’m sure that most of you already heard about unity 3d, if not unity 3d is a : “Unity is a multiplatform game development tool, designed from the start to ease creation”, in other words is an IDE where you can create games very easy.

This is a very simple test “game” I did in about few hours (4-5 including downloading and installing unity and 3d max). You should have some basic knowledge about 3d and games in general, what physics are, some scripting, etc.

Now, you are wandering why this post in an iPhone blog… well it’s too great not to talk about AND you can publish directly for iPhone. I’m sure that you heard about guerilla bob game, guess what,  you can that game just fallowing one of the tutorial step by step… all you need is the models, speaking of what, you should really install a 3d modeling environment, I use 3d studio max (costs a lot, but you can find a freelancers version on torrents….a cracked one if you didn’t got it) it only runs on windows so if you are planning to do some game development on osx this is not an option. It’s important to have this kind of software even is you use it just for conversion, because you never know… in the demo you will see the trees are models downloaded from the internet, but the fence and the grave stones are created by me in 3d max… it’s pretty easy actually.

If I got you with guerilla bob, here is what you need to do, download the free version of unity and start learning, meanwhile find a 3d artist to create your models, when you have something get unity pro for iphone, you have a 30 days trial, and start your game tutorials, there is a great unity tutorial for 3rd person game called “penelope” you can down load it from the unity website.

Here is my demo (remember to install the unity plugin) : unity3d game demo

Flies Squash iPhone Game

September 8th, 2010 1 Comment »

This morning I had the very pleasant surprise to see that the latest update of my iPhone game was approved by Apple in the app store, i rushed to check it and finally it was a success !!!

The problem until now it was that it was crashing on old generations of iphones and ipods…. it was working perfectly with the debug build but the build uploaded to app store has some issues…. any way, I created a new project, added the latest version of cocos 2d and give it a other try.

Enough with the bad stuff, here is the good stuff, the game has some awesome features, you get to smash all those flies, and transform them into a pool of blood, great stuff, especially when you are smashing some one else in your mind ;) got it ?

The game has some great graphics, great game play…. it’s a great game, just go to itunes store open it in itunes install it for free and give it 5 stars and a good comment :D .

Here are some images just to make sure that you can’t resist it :

flies squash iphone game

flies squash iphone game

flies squash iphone game

flies squash iphone game