Friday, January 4, 2013

Learn to program games for iOS: Xcode knowing

logo encabezado curso Aprende a programar juegos para iOS: conociendo Xcode

IPhone News Release Me in a series of didactic content entries: teach you how to program games for iOS in Xcode, always from a perspective closer, easier, and avoiding jargon, so that anyone wanting to create games for Apple devices. I myself have published a few days ago my last game, Fish Lite .

This series of posts are dedicated to people familiar with the computer, but with no special programming skills, in short, and especially in the first steps, anyone can follow. We will touch on some basics of Xcode, and later, we will use Cocos2d to create simple games.

I learned to program games exactly one year ago, having only basic ideas of web design, so anyone in a similar situation can! Just need a Mac (since Xcode, the tool used, can only run on Apple's operating system), looking forward, and thus lose the fear of computer code!

To start, talk of the Apple Developer Program: to make applications for iOS, you need not pay any fees, just download Xcode and iOS SDK. This will allow us to experience, but eventually, we want our artwork appears on the App Store, then yes, we pay 80 Euros to acquire an official license to do so.

That said, let's download Xcode from Apple's website , or from the Mac App Store. Installation is simple, just enough to run the file that you downloaded and wait (may need to register if you choose the first option to download, but it's free).

Once installed, open it and give to create new project. (File> New> Project).

Of all the options, we chose the one we see in the picture:

xcode plantillas posibles Aprende a programar juegos para iOS: conociendo Xcode

This is a simple application with a single window. Then enter a name for our application, and a company identifier (something like the registration of your game, that makes it identifiable to Xcode). You can put anything. Mindful of the boxes you have to check or uncheck:

xcode nombre aplicacion Aprende a programar juegos para iOS: conociendo Xcode

By giving below, we see the structure to create a sample xcode project:

xcode pantalla principal app Aprende a programar juegos para iOS: conociendo Xcode

  • Above, a series of controls that allow you to run the application to test it on the computer and see how it would appear on the iPhone / iPod.
  • On the left are the files that make up your application.
  • In the center are the options for our application. We see that we can change the version, choose whether we want it to iPod / iPhone or Universal, or even the orientation of the application. For now, we leave everything as is.
  • On the right, Xcode shows options that explore later.

Returning to the panel on the left, we look at the classes or files you see inside the folder test. We see that each has two versions with the same name: a finish. "H", and finished in another. "M".

In. "M" is the content itself, the code, so to speak, while the other, for now we do not need.
AppDelegate file is always executed first when starting the application. Always, without exception. In any application. It contains necessary information such as which windows should be charged, or what to do to enter iniciarse.Si AppDelegate.m, we see that at a given location, named "ViewController".

xcode appdelegate Aprende a programar juegos para iOS: conociendo Xcode

This means that in our case, viewcontroller is the name of the file or "window" to display when you start the application, once you have finished reading the AppDelegate file. It can be called in any way, but by default, that's the name taken.

Since this tutorial is a touchdown with Xcode, to create the project we used a template that generates a first and only scene "with graphic support," that is, a third file viewcontroller.xib (besides versions the viewcontroller.h we talked), we can graphically edit unused lines of code, making it easy to create applications.

So we click with the mouse on viewcontroller.xib (the graphical version of our original file, viewcontroller), and drag an object "label" from the panel that found the bottom right (must be sought from all components contains the panel):

xcode label hola Aprende a programar juegos para iOS: conociendo Xcode

Once done, double click on the object label, and put the text you want. Right after, we raise our view play button found in the top of the program, and pressed with the mouse, as we see, is elected the "iPhone Simulator", so we can guess that we will test the application on an iPhone virtual ...

xcode simulador Aprende a programar juegos para iOS: conociendo Xcode

This is what you see! Now you have your first application. When you want to close it, give the Stop button.

I hope, but do not perceive the reason for many things, you have become familiar with Xcode. Structure, simulator applications, etc.

In the following lessons, we'll talk about cocos2d, a different template to which we have used in this example, you will settle in our xcode, and will allow you to program games in a relatively simple, with less code than it would take if we did not have !.

More - Lite Fish

Download - Xcode

Article Learn to program games for iOS: Xcode knowing was originally published in News iPhone .

No comments:

Post a Comment