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


0 Members and 1 Guest are viewing this topic.

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: My iPhone Game Tutorials for Beginners
« Reply #30 on: February 19, 2010, 07:01:08 AM »
Quote
Hi Gandolf,  
 
I'm totally new to Obj-C and not really sure of the scope of instances... I want my game engine object to be able to send messages to my view obect and vice versa, but as I understand it I need to have a Controler object which has instances of both my view class and my game engine class... Then the controller need to mediate between the two... This is a new way of working for me and will require reworking my game code a great deal...  
I believe you wouldn't need to do such things. My obj-c lingo isn't very refined but I believe a good answer for this problem is to integrate the game engine class into the view class. If you want to post your source I can give you a better answer or if you don't feel comfortable you could post a dummy source which doesn't reveal any of your actual code.
 
Quote
Second question, I have built custom UIObjects (buttons which are animated), but they need to be animated with respect to the touch input. (i.e. Touch movement cause the icon to change more White if the touch moves up, more black if moves down etc...).. How can I do this, giving realtime feedback, without blocking the main thread of execution (and other animations)?
You can put UIObjects right in the UIView class and it'll run perfectly with your game or you could make your own kind of a non-UIObject basic button(Shown in tut #3). As for changing colors of the animation, would be possible using the NSTimer but I haven't experimented with that sort of thing.

Code: [Select]
Third question... Does the AppDelegate run in a separate thread? What can I use this class for?
As far as my knowledge, the AppDelegate probably doesn't run in a separate thread but I'm a bit unsure of that. This class can be used for a ton of great stuff, gets deep in your app and can access your view controlls and the view itself. Of course by using commands you can access it from the view or controller itself giving you access to everything in your app anywhere you need it. Works amazing if you want code that runs before your app quits or if you want to be able to set a responder for a UIObject.

Sorry if I didn't give the answer you wanted though if you could point me in a better direction than I might be able to be more on track.


-Gan

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: My iPhone Game Tutorials for Beginners
« Reply #31 on: February 19, 2010, 04:11:36 PM »
Hey guys, I have found code to play music/sound. You can guess what's going to be packaged in the next template update...


-Gan

DWapps


  • GMG Newbie

  • *


  • Posts: 14

  • I love YaBB 1G - SP1!
Re: My iPhone Game Tutorials for Beginners
« Reply #32 on: February 20, 2010, 07:19:49 PM »
idk if it's just me but the 3rd tutorial isn't working for me. I've waited and waited. But it just stops after a few minutes and will not keep going no matter how long i wait.

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: My iPhone Game Tutorials for Beginners
« Reply #33 on: February 20, 2010, 07:31:24 PM »
Try to right click and download. Then watch in QuickTime.
If that doesn't work try this link:
Might still be loading if you click right away.


-Gan

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: My iPhone Game Tutorials for Beginners
« Reply #34 on: February 20, 2010, 08:26:03 PM »
Having a bit of uploading issues so it might take quite a bit longer until the new link works.


-Gan

DWapps


  • GMG Newbie

  • *


  • Posts: 14

  • I love YaBB 1G - SP1!
Re: My iPhone Game Tutorials for Beginners
« Reply #35 on: February 21, 2010, 09:45:33 AM »
Thanks, new link worked fine.

bloodline


  • GMG Newbie

  • *


  • Posts: 4

  • I love YaBB 1G - SP1!
Re: My iPhone Game Tutorials for Beginners
« Reply #36 on: February 22, 2010, 02:52:32 AM »
I just want to add a quick update, it turns out the iPhone's entire event system is multithreaded!

I created a subclass of UIView, and overrode the touches moved method to increase or decrease an internal variable depending upon the direction of touch movement, the. I could then redraw the required image (dependant upon the variable) in the drawRect method, this allows the custom UIView to animate with touches and does not block the other classes which have their own animation code.

Any questions, feel free to ask.


@Gandolf, in Tut3... I'm thinking it would be "More Correct", though not easier, to subview the main menu and the game screen in the superview... this way, one could use IB to build the Menu... and might allow for some other cool stuff, not sure though, as this is all very new to me (I haven't really touched game development since the Amiga days).

I plan to hit OpenGL next, any tips on that would be welcome :)

DWapps


  • GMG Newbie

  • *


  • Posts: 14

  • I love YaBB 1G - SP1!
Re: My iPhone Game Tutorials for Beginners
« Reply #37 on: February 22, 2010, 05:43:51 PM »
My button isn't working, helpp

http:// http://DWapps.yolasite.com ???

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: My iPhone Game Tutorials for Beginners
« Reply #38 on: February 22, 2010, 06:49:15 PM »
Within your button's if statement you had:
Code: [Select]
currentView == 2;
Should only have 1 equal sign. That's it.


-Gan
« Last Edit: February 22, 2010, 06:49:25 PM by Gandolf »

DWapps


  • GMG Newbie

  • *


  • Posts: 14

  • I love YaBB 1G - SP1!
Re: My iPhone Game Tutorials for Beginners
« Reply #39 on: March 01, 2010, 09:12:09 PM »
Could i take the code you provided and use it as my own for selling apps after i add all i need or , can i not do that. All i will be doing is taking your template and adding my code to make an app.
« Last Edit: March 01, 2010, 09:32:04 PM by DWapps »

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: My iPhone Game Tutorials for Beginners
« Reply #40 on: March 01, 2010, 09:13:59 PM »
Yeah go ahead. Absolutely free, it's there to help you guys. (Of course, a little credit wouldn't hurt ;))


-Gan

DWapps


  • GMG Newbie

  • *


  • Posts: 14

  • I love YaBB 1G - SP1!
Re: My iPhone Game Tutorials for Beginners
« Reply #41 on: March 01, 2010, 09:32:56 PM »
Quote
Yeah go ahead. Absolutely free, it's there to help you guys. (Of course, a little credit wouldn't hurt ;))


-Gan

ha k

DWapps


  • GMG Newbie

  • *


  • Posts: 14

  • I love YaBB 1G - SP1!
Re: My iPhone Game Tutorials for Beginners
« Reply #42 on: March 07, 2010, 11:49:31 AM »
Do you know of a graphic design program better than pixen? Pixen is to blocky for what i want to be creating.

gbaldwin9


  • GMG Newbie

  • *


  • Posts: 6

  • I love YaBB 1G - SP1!
Re: My iPhone Game Tutorials for Beginners
« Reply #43 on: March 21, 2010, 06:26:07 PM »


Great tutorials! Just a couple of questions:

How might I go about adding friction so as to slow the ball to a stop?

I'm new to game programming, and would like to essentially make a ball acted like a putted golf ball, or a billiard ball - started by a user swipe and slowing by friction until it reaches a stop.

Can anyone point me in the right direction?

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: My iPhone Game Tutorials for Beginners
« Reply #44 on: March 21, 2010, 07:22:07 PM »
3 main variables:
- Ball's position as a CGPoint.
- Ball's velocity as a CGPoint.
- Friction as a float.

If you add velocity to the ball's position every time it'll move the ball. If you make friction as .9 or another decimal below 1 and multiply it to the velocity, it'll eventually slow the ball to a stop.


-Gan