Cocoa Game Development
Cocoa Game Development
- Subject: Cocoa Game Development
- From: email@hidden
- Date: Mon, 17 Sep 2001 11:29:20 -0500
I have run into a couple problems with game development that I thought
the list could help me with. The game is like F1 sprint which players
race against the computer around one of many tracks. I have a subclass
of NSImageView which shows the track and I add sub views for the cars. I
have figured out a way to see if the cars are colliding and take actions
on them but the track is a different story. The cars should follow the
outside of the track when they hit it (penaltied by a reduction in
speed).
My original thought for handling this was checking the color of the
background image at each of the corners of the cars to see if they are
on the track. If not reducing speed and rotating the car as needed.
Problem 1: I haven't been able to find a method that will give me the
color of a pixel of a graphic (I'm using tiff, but could use something
else).
Next problem is that the tracks often have crossings, loops, etc. that
could be driven the wrong way making it possible to not go a whole lap
of the course. I thought about this problem from a color perspective
again where the track gets gradually darker as it moves on, so I could
find what darkness the car is at and therefore where it is on the track.
Controlling the computer cars has also presented a problem that I
haven't even started to think about.
I have a feeling that these are not the best methods of controlling the
game. So the overall question that I have is, how should I structure
this game? I think that using sprites as the roads would bog the game
down so I am looking for a different solution???
TIA,
Dan