Game Maker's Garage Forum

Game Creation => Code Exchange => Topic started by: Gan on February 27, 2010, 09:40:51 PM

Title: My Mac Game Tutorials for Beginners
Post by: Gan on February 27, 2010, 09:40:51 PM
Hey guys, I've finally come up with the time to make My Mac Game Tutorials for Beginners
 
The purpose of the tutorials is to teach you guys how to make your own games for the Mac platform using Xcode, Cocoa, and Obj-C. I have created a template(Download is below) that will make the process painless and quite fun.
 
Right-click to download. Stars(*) mean downloads that go along with tutorial.  
 
Tutorial #1(65mb,10min): StickMan! And the basics to making Mac Games (http://web.mac.com/avisaria/MacGameTutorial1.mov)
*Walking Stick Guy (http://web.mac.com/avisaria/WalkingStickGuy.zip)
 
*Mac Game Template Download (http://web.mac.com/avisaria/MacGameTemplate.zip)
 
 
-Gandolf
P.S. If you encounter an error when trying to download a tutorial, that's because the tutorial is still uploading.
P.S.S. I go more into detail on syntax in the iPhone Game Tutorial Series, visit there to learn more of the basics.
Title: Re: My Mac Game Tutorials for Beginners
Post by: GMG Kurt on September 10, 2011, 10:28:57 PM
how did you get that game-logic timer to work? It just looked like a regular method  :-/
Title: Re: My Mac Game Tutorials for Beginners
Post by: Gan on September 10, 2011, 10:52:12 PM
It is.
You create an nstimer and set it to call a method every few milliseconds.
Title: Re: My Mac Game Tutorials for Beginners
Post by: GMG Kurt on September 11, 2011, 04:16:29 PM
Code: [Select]
//***Turn on Game Timer
gameTimer = [NSTimer scheduledTimerWithTimeInterval: 0.02
 target: self
   selector: @selector(handleGameTimer:)
   userInfo: nil
repeats: YES];
}

- (void) handleGameTimer: (NSTimer *) gameTimer {
//All game logic goes here, this is updated 60 times a second


//This updates the screen
[self setNeedsDisplay:YES];
}

oh of course NeXtStep  :P

where it says: "scheduledTimerWithTimeInterval: 0.02"
that is .02 of what? a second? But if its a second why does the method say it updates 60 times a second?
Title: Re: My Mac Game Tutorials for Beginners
Post by: Gan on September 11, 2011, 06:14:53 PM
Yeah, that means the timer fires every .2 seconds.
Which is pretty much the same as 1.0/60.0 which is 60 frames a second.
Title: Re: My Mac Game Tutorials for Beginners
Post by: GMG Kurt on September 11, 2011, 07:10:11 PM
OOOOHHHH. I see  ;D Thanks