Welcome to iPhoneGameTutorials.com! Check out our Tutorials page for a list of everything we've written
so far, and drop by the Forums to let us know what you would like to see written about on the site.

Archive for the 'Cocos2d' Category

Page 2 of 3

How to Build an RPG Style Game for the iPhone

Role playing games are a hugely popular genre of game – some of our favorite games over the years have been RPG’s. One of the projects we’ve been working on lately is an RPG style game. It’s been a challenging task, so we thought we should share some of the information on how we put it together! RPG’s can be a complex genre with lots of different game design mechanics, so let’s go ahead and spell out what we’re trying to build here:

  • A Menu system, including both an Options and Credits screen, that will build from our previous Menu tutorials
  • How to build a top down, tile based map using Tiled, a free tool for creating tiled based maps!
  • RPG’s almost always tell a story, and in our case we have some videos to help move the story along. We’ll show how to play an intro video to set things up, as well as a video before starting a mission.
  • Generally, your character(s) have missions to go through with mission objectives and win/lose conditions. We’ll show you how to display these to your player before they start the mission, and later on show how to build these into the game.
  • Our game is going to have multiple playable characters so we’ll have a character select screen. We’ll start with something simple and later on add in more complexity.
  • Dialog is another important aspect so we’ll show some character dialog at the start of our missions.

That’s probably enough to get us started on the road to a working game for now. Let’s talk briefly about role playing games – they have been around for a looong time, before digital games even existed. While there are definitely others, Dungeons & Dragons was probably the most popular pen and paper role playing game. RPG’s have come a long way since then and have transcended all consoles and are still popular to this day in a variety of forms, including MMORPG’s and so on. Hopefully with our help, you all will be able to keep the trend going and create some awesome games for the iPhone! The tutorials will start coming soon so stay posted!

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

How To Build a Tower Defense Game for the iPhone – Part 4 – Starting the Tower Attack

We’re back with another lesson in the never ending saga to create the perfect tower defense game. This is part 4 of the series, you would be well advised to consult the first 3 tutorials in the series, starting here, before attempting this section.


Today we are going to charge right into the newest section in the series – “Starting the tower attack!” This is one of the most important components in a tower defense game and will ultimately be one of the most enjoyable to program. I will definitely not get to all the cooler aspects of attacking towers in this one section, but I promise that we will create all sorts of fun towers soon. You will however, at the end of this particular tutorial, have enough knowledge to make any cool towers you can think of. I’ve tried to make the code robust enough for that!

If you haven’t read “Cocos2d Game Tutorial – How To Build a Tower Defense Game for the iPhone – Part 1 – Creep Waves!“, you may want to review it before you continue on.

Source code after the break.
Continue reading ‘How To Build a Tower Defense Game for the iPhone – Part 4 – Starting the Tower Attack’

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

How To Build a Tower Defense Game for the iPhone – Part 3 – Rotation and Realism.

Welcome to part 3 of the tower defense series – Today we are going to be delving into the fine art of realism. Nothing ruins the immersion of games like something that doesn’t make sense in the real world (unless that’s what your game is completely about. Since most tower defense games are rooted in the real world, we need to make sure that the items in the game act like real object. If you haven’t read “Cocos2d Game Tutorial – How To Build a Tower Defense Game for the iPhone – Part 1 – Creep Waves!“, you may want to review it before you continue on.

We’re doing a two fold thing, in this tutorial – We’re going to bring Part 1 and Part 2 together and add realism by adding some rotation and targeting to our towers and creeps.

  • Towers need to be able to target the nearest creep
  • Towers need to face in the direction of the creep they’re targeting
  • Creeps need to rotate when they move in a specific direction

Source code after the break.
Continue reading ‘How To Build a Tower Defense Game for the iPhone – Part 3 – Rotation and Realism.’

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

Getting Started With Cocos2D and OpenFeint

OpenFeintWe just started integrating OpenFeint into Drop Dead, the Cocos2D-iPhone game we released towards the end of last year. The process was somewhat grueling, given that Open Feint’s instructions, in my opinion, are really lacking in the clarity needed for someone doing this for the first time. Obviously I was able to find several resources online:

OpenFeint and Cocos2d-iPhone
Tutorial – Implement OpenFeint into Cocos2d Game
Integrating OpenFeint with Cocos2D for iPhone

But those are out of date at this point – OpenFeint is now up to version 2.10 and Cocos2D is at 0.99.5. So, after all the time we put into getting OpenFeint to initialize properly, we decided to throw together a template to help get you started with the process! We took the Cocos2D Hello World example, set it to be in portrait orientation, and put together an XCode project (using XCode 3.2.5, not 4.0 yet). Source code after the break! Continue reading ‘Getting Started With Cocos2D and OpenFeint’

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

How To Build a Tower Defense Game for the iPhone – Part 2 – Placing Towers.

Welcome to part 2 of the tower defense series for the iphone using cocos2d – Today we’re going to be adding code to place towers. Whoa, slow down there you say – “place towers? That’s crazy talk”. I assure you it isn’t and once you are able to place towers in the next section we will combine our lessons together to have a single level of play! If you haven’t read “Cocos2d Game Tutorial – How To Build a Tower Defense Game for the iPhone – Part 1 – Creep Waves!“, you may want to review it before you continue on.

Ok, so one thing you may have learned from the last article was that making games isn’t like real life – it just need to act like real life. We didn’t need a complicated A*, DFS/BFS or Best-first searches to move our enemies around. In fact we didn’t need a tile based map at all. That doesn’t mean we still won’t need one in the future, but for now we follow the K.I.S.S system (keep it simple, stupid).

So lets take a look at what we are trying to recreate. Try to place the tower and see how it works – Please forgive me for my poor “gun tower” skills!

Source code after the break!
Continue reading ‘How To Build a Tower Defense Game for the iPhone – Part 2 – Placing Towers.’

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

How To Build a Tower Defense Game for the iPhone – Part 1 – Creep Waves!

We made it! We’ve talked a little about design and have a fairly good idea of what the finish product will look like when we’re all done. Now we start the task of coding the thing. The first step for any tower defense game is the “creeps”. Creeps are the enemy characters that are invading your tower defense world and that you need to repel. So what are we going to do in this tutorial? Because this is just the first of a few, this is some of the items we’re going to cover:

  • How to make waypoint.
  • How to load up a tile based map and use objects from it instead of hardcoding them
  • How to create Creeps/Bad Guys/ Enemies you name it
  • How to make the move along our predetermined path
  • How to do smooth scrolling on the iPhone

Without those things the game will not be much of a tower defense game. Well, some of the items are just nice goodies, but we want them so we’re getting them in right away! So in this first installment I am going to going to show you how to have a basic enemy follow a predefined path on a tilemap, by following a series of waypoints. By the end of this series, you will have all the information to be well on your way to making the next great tower defense game.

Source code after the break!
Continue reading ‘How To Build a Tower Defense Game for the iPhone – Part 1 – Creep Waves!’

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

How To Build a Tower Defense Game for the iPhone

We’ve been doing a lot of simple game mechanics and one of our favorite for a long time has been the tower defense game – So in an effort to do this right, since programming this will take some time, lets talk a little tower defense design and goals.

Tower Defense Description:

  • The enemy starts at one side of a map and travels along a path towards a destination ( usually on the opposite side of the map).
  • You create towers along these paths that fire on the enemy while they pass through. 
Attempt to survive wave after wave of stronger and stronger enemies by upgrading your towers with more powerful abilities.
  • You can either win the game by beating the final wave (usually 20 to 50 waves) or keep going till you lose and there by get bragging rights when you die at wave 97.
Learn Cocos2d - Tower Defense Tutorial for iPhone

A simple tower defense game tutorial for the iphone

There is not a “casual game” that better defines the word casual – The player makes a simple placement of a towers and make small upgrades while the battle unfolds. Who hasn’t played a tower defense game and lost on the 48th level of a 50 level game, because you didn’t plan for multiple types of enemies to attack at the same time.  You can literally spend hours revising tower defense games to see if you can “beat” the game faster, get the most money or just win with the fewest towers.

Continue reading ‘How To Build a Tower Defense Game for the iPhone’

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

Building a Slide Image Game (Part 2 – With Solution)

Hi Everyone! We’re going to revisit the image sliding tutorial to add one additional feature. We are going to determine whether the puzzle has been solved or not. The task should be fairly straight forward so lets get started right away!

Source code after the break!
Continue reading ‘Building a Slide Image Game (Part 2 – With Solution)’

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

Building a Match 3 Type Game

So, we’ve set the ground work to start actually building a game with our menu, sprite, touch and animations tutorials using cocos2d. Now lets try something a little more adventurous – Lets actually create a simple “match 3″ game. What’s is a match 3 game, you may be asking… Well you’ve played them before I’m sure if you’ve ever played a flash game on the internet (The most famous of them being bejeweled). You can see the full game here – It’s free for the full game now! Drop Dead – Check it out now on itunes. The game play mechanic is very straight forward -

  1. You create tiles with different looks
  2. You randomly place those tiles in a 7×7 or 8×8 grid
  3. If three of the same objects line up either vertically or horizontally they all get removed from the grid
  4. All objects then fall to fill the gaps left by the removed tiles

Done.   Can’t we do it… Hell yeah we can… So lets ge started.

Source code after the break!
Continue reading ‘Building a Match 3 Type Game’

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

Drop Dead – Match 3 Game for the IPhone

We put this game together during Halloween last year, but who’s kidding who, Zombies work whatever time of year it is! It’s called Drop Dead – Check it out now on itunes

What makes this even better – Over the next few weeks, we’ll be posting snippets of the complete game so you can make one of these games yourself!  So stay tuned and in the meantime, if you want to support the blog, pick up the game!

The first thing you might notice when playing the game, looking at the screen grabs, or watching ourDrop Dead YouTube video is that it has the basis in some of the tutorials we have already presented. The match 3 game concept is a great game mechanic and doesn’t take too much time to put together.

The story is this: “In Drop Dead it’s up to you to help our confused hero escape the zombie apocalypse. Match blocks to gain time and ultimately escape from your hungry pursuers. Playing through Story Mode will unlock levels in Endless Hoards mode and Impending Doom mode for hours of re-playability!”

For those who don’t have the spare change – Here is the light version of Drop Dead

Some of the great concepts that we’ll be going over in future tutorials will be these - Drop Dead Game Overview:

  • SplashScreen
  • Loading Screen
  • Menu Page
  • Option Page (w/ slide bars)
  • Mission Page
  • Game (match 3 style game w/ powerups for getting multiple combos)
  • Save States with each level unlocked
  • Saved Scores (top score on each level)
  • Music and Zombie Sound bites

We hope you love the game and keep focus on this blog… We’re gonna be showing some great stuff!

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter





Switch to our mobile site