Topic:   My iPhone Game Tutorials for Beginners   (Read 423843 times)


0 Members and 1 Guest are viewing this topic.

I-NEED-HELP


  • GMG Newbie

  • *


  • Posts: 40

  • I love YaBB 1G - SP1!
Re: My iPhone Game Tutorials for Beginners
« Reply #120 on: August 11, 2010, 04:36:18 PM »
Thank you!!!!! In the credits of my game who should I put you as?
Gandolf from the GMG forums?

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: My iPhone Game Tutorials for Beginners
« Reply #121 on: August 11, 2010, 05:07:34 PM »
Gandolf or Matthew French. Either would be fine.


-Gan

I-NEED-HELP


  • GMG Newbie

  • *


  • Posts: 40

  • I love YaBB 1G - SP1!
Re: My iPhone Game Tutorials for Beginners
« Reply #122 on: August 11, 2010, 10:50:49 PM »
Also, I was trying to figure out how to play music in games. Before, I just added the AVFoundation.framework file, #imported the header into the project, and then used this bit of code in awakeFromNib to load, play, and keep looping the music:

NSString* pathToMusicFile = [[NSBundle mainBundle] pathForResource:@"MusicFile" ofType:@"mp3"];
AVAudioPlayer* music = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:pathToMusicFile] error:NULL];
music.numberOfLoops = -1;
music.volume = 1;
[music play];

But every time I try this in the Ultimate iPhone Template, I get an error whether I compile for the simulator or for a device. Any help is much appreciated! Thanks.
« Last Edit: August 12, 2010, 05:25:30 PM by I-NEED-HELP »

I-NEED-HELP


  • GMG Newbie

  • *


  • Posts: 40

  • I love YaBB 1G - SP1!
Re: My iPhone Game Tutorials for Beginners
« Reply #123 on: August 12, 2010, 10:51:37 PM »
Ah, I managed to get that working by dragging/dropping the AVFoundation framework from a different project into the frameworks folder of the Ultimate iPhone Template. But now I need help with figuring out how to draw text in the UIT... I tried copying over the files from the OpenGL template for Texture2D.h/.m, but it still wouldn't let me draw text - it wouldn't give an error, it just wouldn't draw the text. Any help is much appreciated.

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: My iPhone Game Tutorials for Beginners
« Reply #124 on: August 12, 2010, 11:20:24 PM »
Yeah text drawing is incomplete in the template. Later I'll update it and stick it up.


-Gan

I-NEED-HELP


  • GMG Newbie

  • *


  • Posts: 40

  • I love YaBB 1G - SP1!
Re: My iPhone Game Tutorials for Beginners
« Reply #125 on: August 12, 2010, 11:29:56 PM »
How long do you think that will take? Thank you for all the awesome work you've done on the template though. Me and a friend are making a game now, and without the template we would be stuck with buttons and switches and labels and static UIImages. Thanks man!

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: My iPhone Game Tutorials for Beginners
« Reply #126 on: August 12, 2010, 11:57:26 PM »
Glad you like it. I'll stick up the update sometime tomorrow.
Drawing text is a bit different in OpenGl than what you're use to. You'll find out later.


-Gan

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: My iPhone Game Tutorials for Beginners
« Reply #127 on: August 13, 2010, 04:50:12 PM »
http://web.mac.com/avisaria/Ultimate%20iPhone%20Template%20Portrait.zip

If you need to customize text color, size, or font just ask.


-Gan

I-NEED-HELP


  • GMG Newbie

  • *


  • Posts: 40

  • I love YaBB 1G - SP1!
Re: My iPhone Game Tutorials for Beginners
« Reply #128 on: August 13, 2010, 05:27:02 PM »
Thank you!

Is it possible to have game logic and have the AppDelegate doing stuff when the game is in its menu? I want to have menu music and then different music for in-game. How do you think I should do this? BTW the music is longer than 30 seconds.

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: My iPhone Game Tutorials for Beginners
« Reply #129 on: August 13, 2010, 06:11:05 PM »
For having game logic running during the menu just move around the initializeTimer and pauseTimer commands until it suits your needs.
The code you have for music will work fine for main menu music. Just tell it to play when entering the main menu.

Sorry for the vague answers. Power's out and on iPhone.


-Gan

I-NEED-HELP


  • GMG Newbie

  • *


  • Posts: 40

  • I love YaBB 1G - SP1!
Re: My iPhone Game Tutorials for Beginners
« Reply #130 on: August 13, 2010, 06:16:49 PM »
Ah. I see. That makes sense, thank you! (haha I'm on my iPod Touch)

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Re: My iPhone Game Tutorials for Beginners
« Reply #131 on: August 13, 2010, 06:43:27 PM »
Hehehe... good old Gan.

Teaching the world how to program, one forum member at a time! ;D
« Last Edit: August 13, 2010, 06:44:50 PM by Silverwind »
I survived the spammage of 2007

I-NEED-HELP


  • GMG Newbie

  • *


  • Posts: 40

  • I love YaBB 1G - SP1!
Re: My iPhone Game Tutorials for Beginners
« Reply #132 on: August 14, 2010, 10:10:23 AM »
Is it possible to use custom fonts, or must you use the default fonts pre-installed on the iPhone?

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: My iPhone Game Tutorials for Beginners
« Reply #133 on: August 14, 2010, 10:28:05 AM »
There's only a limited number of fonts on the iPhone. To change the font go to the GameView class, search Georgia and replace it with your font name. The default size is 15, you can change that as well.


-Gan

breshi


  • GMG Newbie

  • *


  • Posts: 31

  • Carpe Diem
Re: My iPhone Game Tutorials for Beginners
« Reply #134 on: August 18, 2010, 01:23:56 AM »
"Teaching the world how to program, one forum member at a time!"
- My turn!

I am trying  to understand the logic of your new template and work out why there is code in AppDelegate and GameView for ball collisions. What type of coding goes in each, in your last template all I really had to do was modify the AppDelegate.

Also in the xib the color is set to white but the background is black. I could eventually figure out where you set this but thought I would be lazy and ask the question.
Thanks!!