I debut in Actualidad iPhone with a series of educational content posts: I'll teach you how to program iOS games in Xcode; always, from a close, easy point of view, and avoiding technicalities, so that anyone with a desire can create games for Apple devices. I myself have published my latest game a few days ago, Lite Fish.
This series of posts are dedicated to people familiar with computers, but without special programming notions; In short, and especially in the first steps, anyone can follow it. We will touch on some basic aspects of Xcode, and later, we will use Cocos2D to create very simple games.
I learned to program games exactly one year ago, just having basic web design ideas; so anyone in a similar situation can do it! You only need a Mac (since Xcode, the tool used, can only run on Apple's operating system), really want to, and lose your fear of so much computer code!
To begin with, we will talk about Apple's developer program: to make applications for iOS, you do not need to pay any fees, just download Xcode and the iOS SDK. This will allow us to experiment; But if the time comes, we want our work of art to appear in the App Store, there yes, we will have to pay 80 Euros to acquire an official license and be able to do so.
With that said, let's download xcode from the Apple website, or from the Mac App Store. Its installation is simple, you just have to run the file that we have downloaded and wait (It may be necessary to register if you choose the first download option, but it is free).
Once installed, we open it, and we create a new project. (Fillet>new>project).
From among all the options, we choose the one we see in the image:
By giving the following, we see the structure that xcode shows when creating a project:
- Above, a series of controls that will allow us to run the application in order 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 our application.
- In the center are the options of our application. We see that we can change the version, choose if we want it to be for iPod / iPhone or Universal, or even the orientation of the application. For now, we leave everything as is.
- On the right, Xcode shows us options that we'll explore later.
Going back to the left panel, we take a look at the classes or files that we see inside the test folder. We see that each one has two versions with the same name: one ending in ".h", and the other ending in ".m".
This means that in our case, view controller is the name of the file or "window" that will be displayed when the application is started, once the AppDelegate file has finished reading. It can be called in any way, but by default, that is the name it has taken.
Since this tutorial is an introduction to Xcode, when creating the project we used a template that generates a first and only scene "with graphical help"; that is, a third file viewcontroller.xib(in addition to the versions viewcontroller.m and the viewcontroller.h that we had talked about), that we can edit graphically without using lines of code, which facilitates the creation of applications.
So, we click with the mouse on viewcontroller.xib (the graphical version of our initial file, viewcontroller), and drag an object «label»From the panel found at the bottom right (you have to find it from among all the components that this panel contains):
Once done, we double click on that label object, and put the text we want. Right after, we looked up at the button play that we find in the upper part of the program, and we press it with the mouse; As we can see, the "iPhone Simulator" has been chosen, so we can guess that we are going to test the application on a virtual iPhone ...
This is what appears! You already have your first application. When you want to close it, click the button Stop.
I hope that, although you do not understand the why of many things, you have become familiar with Xcode. Its structure, its application simulator, etc.
In the following lessons, we will talk about Cocos2D; a different template from the one we have used in this example, which we will install in our xcode, and which will allow us to program games in a relatively simple way, with less code than would be needed if we did not have it!
More information - Lite Fish
Download - Xcode
Phenomenal
Great article!!
The initiative was very good, I tried to get on with it but I left it, to see if now I can get hooked.
Thanks for the article! ... hopefully many more will come
Great, I was looking forward to something like that!
Great, how often will you keep putting articles like this.
Good article, I am a programmer of PC and Android games, the truth seems to me your initiative is good, I have always wanted to launch myself on iOS, maybe, just maybe, some day, I will launch xcode for windows and there the doors will open for the poor like me xD
you can buy mac os x and install it on a pc, it is very easy to search online
I believe you, but first, if it really worked well, I doubt that mac would be sold as they are sold ... and I'm not just saying it because of the cost of the computer, but also the high cost of publishing in the app store, which compared to other platforms It is very high.
Actually I second the opinion of paco, I write you from a hackintosh, look for the versions of iatkos it is very easy to install, I have not used windows for a long time
Many people do not change because of that same fear and the crazy ideas that they have been dragging along.
Congratulations on your initiative Sergio
Thank you very much, all very clear for a first contact, I liked it a lot and I already have a thousand ideas in mind ... I hope you cheer up and keep getting such good articles.
Excellent !, I hope you continue and do not stay with these tutorials halfway like many.
Thank you all very much, I'm glad you liked it! I will try to contribute everything in my power in the following entries, and I hope you find them just as interesting :)!
Before jumping into the pool with cocos2d-iphone, I would consider starting the tutorials on cocosbuilder 3.0 and cocos2d-js directly, it seems that there is the immediate future, and more in Spain, which is the kingdom of Android and it is a good idea to remove cross-platform things.
I take this opportunity for those of you who are going to follow these tutorials to take a look at http://www.raywenderlich.com, there is tons of very useful information on many topics in iPhone programming, games included.
By the way, congratulations on the game 🙂
Hello, we are a group of university students whose work project is to develop a very simple app on a specific topic. We have really liked your publications, even so we are a little lost on the subject because we have never done it before. Could we get in touch privately to see our possibilities? Thanks 🙂
Man with searching a little one realizes that it is not necessary a mac to use osx with the scene iaktos
Returning to the topic Very good article and good initiative most xcode manuals are in English and difficult you should think about publishing a manual in apple ibook store
I think it's a great idea!!! keep it up !!!
I encourage you like many not to stop publishing this course and I will be one of your faithful by coming to class
Bravo, congratulations on the initiative.
I just bought a second-hand Mac mini, just to learn how to program for IOS, I have already downloaded many books in Spanish and soon I will start to try to handle Xcode, I thank you very much for the initiative and I will be a regular follower of yours.
Thank you…
I want more !!
Good work, good article, although I have a question
Is there a way to program but for windows some other program?
For IOS, and actually for any mobile platform, there is Adobe Flex and Air, Frameworks that allow the development of applications. It is the only solution I have found to generate something for apple mobiles from windows. Or raise virtual machines with mac os x, to be able to raise xcode, although I do not recommend it, because it is a real pain. Far, it is preferable to invest in a mac, if your focus is the applications in IOS.
Help me with the next lesson to continue with this excellent contribution? Thank you..