Cocoa Game Programming Workshop

Apprentice
Posts: 14
Joined: 2008.10
Post: #1
SpiderWorks has a book called "Cocoa Game Programming Workshop" by David Hill for sale. It looks very promising, so I just bought it. I'm having trouble getting the code in the book to work properly. Even the sample code doesn't work properly. They don't have a support forum or any way to contact the author, so I figured I'd post here and see if anybody else has any experience with this book.
Quote this message in a reply
Apprentice
Posts: 18
Joined: 2005.07
Post: #2
I also purchased this book. I didn't have any problems with the code, everything worked fine. It's actually a pretty good value for $10 and it's a pretty quick read full of examples and info for a beginning game programmer. He even takes you through code refactoring steps as he develops his game through the book.

The only complaint I had about it is that about half-way through, the author stops taking you through step-by-step and just highlights the changes he makes briefly and expects you to be able to follow along. Kind of hard if you're new to Objective-C and game programming.
Quote this message in a reply
Apprentice
Posts: 14
Joined: 2008.10
Post: #3
JonTrainer Wrote:I also purchased this book. I didn't have any problems with the code, everything worked fine. It's actually a pretty good value for $10 and it's a pretty quick read full of examples and info for a beginning game programmer. He even takes you through code refactoring steps as he develops his game through the book.

I don't have too many problems following the code, but you're right, it could be organized better. In chapter 3, I'm have a problem getting my figure to shoot & I have narrowed down my -keyPress method. Everything up to that point works fine. I am very hopeful for this book, it looks like it has a lot of potential.

One cool thing is that I wrote to customer support and they wrote back to me quickly.
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #4
Maybe the codes wrong on purpose so you learn how to debug..

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Apprentice
Posts: 14
Joined: 2008.10
Post: #5
unknown Wrote:Maybe the codes wrong on purpose so you learn how to debug..

Uh, no. I'm pretty sure if that was his intention, he would have written that in the book...

Anyway, I still haven't figured out what the problem is with shooting, so I wrote my own "else if" statements and used seperate keys to indicate shooting. I was able to implement everything after that so far though, and it all works fine. I must have a minor typo somewhere.
Quote this message in a reply
Apprentice
Posts: 14
Joined: 2008.10
Post: #6
I am using a PowerBook & don't have a numeric keypad (at least not without holding down the "fn" key), but the code in the book uses keypad numbers for controls. I took the author's suggestion and changed the keys from "8246" to "wsad". The problem is, when you do that, if you hold down the shift key it would only fire straight up!

At first, I thought there might be a typo in the code. I didn't understand what the unary & was for when checking, so I changed that to a &&, then I was able to fire, but couldn't move! I wrote some debugging code (mostly NSLogs) and also created another shooting scheme using seperate keys to fire.

Finally, I decided that there must be something about the code I wasn't understanding quite right. As it turns out, the charactersIgnoringModifiers method DOESN'T ignore the shift key. Therefore, pressing "shift + w" was actually pressing "W", and therefore the direction was always 0, or up. All I had to do was add checks for capital letters in addition to lower case to get the code to act correctly.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Upcoming Multiplatform Game Programming Book for Beginners JazonYamamoto 3 1,227 Apr 14, 2014 05:55 PM
Last Post: JustinFic
  Game engines with object programming JonnyThunder 3 8,144 Aug 16, 2010 10:42 AM
Last Post: SethWillits
  free mac game programming book jaked 4 6,697 Jun 8, 2009 12:48 AM
Last Post: SethWillits
  Game Programming Tutorial markvw 0 4,253 Jan 27, 2009 05:10 AM
Last Post: markvw
  Game Programming for iPhone? Help with Cocoa and MVC. holografix 7 6,577 Jan 22, 2009 08:17 AM
Last Post: AnotherJake