How To Make a Tower Defense Game
21 posts
• Page 1 of 3 • 1, 2, 3
How To Make a Tower Defense Game
This is the official thread to discuss the following blog post: How To Make a Tower Defense Game
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ray Wenderlich
Blog: http://www.raywenderlich.com
Twitter: http://twitter.com/rwenderlich
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ray Wenderlich
Blog: http://www.raywenderlich.com
Twitter: http://twitter.com/rwenderlich
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

rwenderlich - Site Admin
- Posts: 1776
- Joined: Thu Dec 23, 2010 4:14 pm
- Has thanked: 26 times
- Been thanked: 186 times
Re: How To Make a Tower Defense Game
Great tutorial. Will certainly give it a try.
please try my app
http://itunes.apple.com/us/app/galactic ... ?ls=1&mt=8
http://itunes.apple.com/us/app/galactic ... ?ls=1&mt=8
-

rrdz473 - Uber Haxx0r
- Posts: 53
- Joined: Wed Jun 01, 2011 12:45 am
- Has thanked: 4 times
- Been thanked: 1 time
Re: How To Make a Tower Defense Game
Great tutorial! I have been waiting for this one!
Another great tutorial for this topic is at: http://www.iphonegametutorials.com/2011 ... he-iphone/
You can combine ideas from both of them!
Another great tutorial for this topic is at: http://www.iphonegametutorials.com/2011 ... he-iphone/
You can combine ideas from both of them!
- Psevertson
- Baby Hacker
- Posts: 8
- Joined: Sat Mar 10, 2012 1:06 am
- Has thanked: 1 time
- Been thanked: 1 time
Re: How To Make a Tower Defense Game
In the starter projects Appdelegate you forgot to enable retina display by removing the // at line 73
if( ! [director enableRetinaDisplay:YES] )
CCLOG(@"Retina Display Not supported");
Thanks for the great tutorial !
if( ! [director enableRetinaDisplay:YES] )
CCLOG(@"Retina Display Not supported");
Thanks for the great tutorial !
- mountainmarc1972
- n00b
- Posts: 3
- Joined: Fri Jun 01, 2012 5:55 pm
- Has thanked: 0 time
- Been thanked: 0 time
Re: How To Make a Tower Defense Game
Superb tutorial as always!!
One minor thing, at the end of the tutorial where it says open Enemy.M and add the lines #import "SimpleAudioEngine.h"
This is not needed as the line is already in there from earlier when you created the Enemy class.
@mountainmarc1972
For me, removing the // at line 73, then running it on an iphone 4 makes things go funny. The waypoints and tower placements are ok, but the background picture is smaller than the screen (due to retina) and the enemy heath bars are out of place...
It looks ok on the Simulator though.
Keep up the good work!
One minor thing, at the end of the tutorial where it says open Enemy.M and add the lines #import "SimpleAudioEngine.h"
This is not needed as the line is already in there from earlier when you created the Enemy class.
@mountainmarc1972
For me, removing the // at line 73, then running it on an iphone 4 makes things go funny. The waypoints and tower placements are ok, but the background picture is smaller than the screen (due to retina) and the enemy heath bars are out of place...
It looks ok on the Simulator though.
Keep up the good work!
- JohnL
- Hacker
- Posts: 10
- Joined: Sat Aug 18, 2012 4:35 pm
- Has thanked: 0 time
- Been thanked: 0 time
Re: How To Make a Tower Defense Game
I keep getting the following error which seems to point to glColor4f in the draw method.
I also get
I'm running Cocos2d 2.0. Any ideas why I get this?
Implicit declaration of function 'glColor4f' is invalid in C99
I also get
in the console when I run it.OpenGL error 0x0502 in -[CCSprite draw] 532
I'm running Cocos2d 2.0. Any ideas why I get this?
- Rabbitpuncher
- Baby Hacker
- Posts: 8
- Joined: Tue May 01, 2012 1:06 pm
- Has thanked: 0 time
- Been thanked: 0 time
Re: How To Make a Tower Defense Game
@Rabbitpuncher: Oh, this is because that funcion to draw the life bars deal with Opengl 1.x calls, that is why it doesn;t work with Cocos2d 2.x (Which uses OpenglES 2.0). I am no OpenGl expert so I wouldn't know how to translate them to 2.0, can anyone help?
-

Pabloruiz55 - iOS Tutorial Team Member
- Posts: 10
- Joined: Thu Jan 26, 2012 9:19 am
- Location: Buenos Aires, Argentina
- Has thanked: 0 time
- Been thanked: 1 time
Re: How To Make a Tower Defense Game
Pablo...I'll research that a bit and see. Thanks...I love the tutorial!
- Rabbitpuncher
- Baby Hacker
- Posts: 8
- Joined: Tue May 01, 2012 1:06 pm
- Has thanked: 0 time
- Been thanked: 0 time
Re: How To Make a Tower Defense Game
TowerPosition.plist have 12 Items but in loadTowerPositions method
towersBases = [[NSMutaleArray alloc] initWithCapacity:10];
why is 10 than 11 ?
towersBases = [[NSMutaleArray alloc] initWithCapacity:10];
why is 10 than 11 ?
- doninox
- n00b
- Posts: 1
- Joined: Wed Aug 22, 2012 2:00 am
- Has thanked: 0 time
- Been thanked: 0 time
Re: How To Make a Tower Defense Game
If you are using Cocos2d 2.x use "ccDrawSolidPoly" method to draw health bar.
In Enemy.m "draw" method replace code to
Use ccDrawSolidPoly instead of ccFillPoly.
ccFillPoly will cause problem in coco2d 2.x.
In Enemy.m "draw" method replace code to
- Code: Select all
CGPoint healthBarBack[] = {ccp(mySprite.position.x -10,mySprite.position.y+16),ccp(mySprite.position.x+10,mySprite.position.y+16),ccp(mySprite.position.x+10,mySprite.position.y+14),ccp(mySprite.position.x-10,mySprite.position.y+14)};
ccDrawSolidPoly(healthBarBack, 4, ccc4f(255, 0, 0, 255));
CGPoint healthBar[] = {ccp(mySprite.position.x + HEALTH_BAR_ORIGIN,mySprite.position.y+16),ccp(mySprite.position.x+HEALTH_BAR_ORIGIN+(float)(currentHp * HEALTH_BAR_WIDTH) / maxHp,mySprite.position.y+16),ccp(mySprite.position.x+HEALTH_BAR_ORIGIN+(float)(currentHp * HEALTH_BAR_WIDTH) / maxHp,mySprite.position.y+14),ccp(mySprite.position.x+HEALTH_BAR_ORIGIN,mySprite.position.y+14)};
ccDrawSolidPoly(healthBar, 4, ccc4f(0, 255, 0, 255));
Use ccDrawSolidPoly instead of ccFillPoly.
ccFillPoly will cause problem in coco2d 2.x.
- tomneo2004
- Hacker
- Posts: 29
- Joined: Wed Jun 13, 2012 6:43 am
- Has thanked: 0 time
- Been thanked: 0 time
21 posts
• Page 1 of 3 • 1, 2, 3
Who is online
Users browsing this forum: No registered users and 10 guests