Just fyi, you don't need pixel-perfect collision detection for sufficient collision detection. I don't think most games bother. If you can do it easily, then great, but I don't think it's very common. Often, it's undesirable, because, for a variey of reasons, you want to treat your objects as some other type of shape, such as a circle, rectangle, or ellipsoid. Often in shooters, the collision area for the hero character will be slightly smaller than the graphics in order to give the player a little breathing room and keep them from feeling cheated when a bullet barely grazes them.
Here are some good books: http://www.amazon.com/Collision-Detection-Interactive-Environments-Technology/dp/155860801X/ref=pd_bbs_sr_2?ie=UTF8&s=books&qid=1216958047&sr=8-2 http://www.amazon.com/Geometric-Computer-Graphics-Morgan-Kaufmann/dp/1558605940/ref=sr_1_7?ie=UTF8&s=books&qid=1216958078&sr=1-7 The first one says "3D" in the title, but it's just as applicable to 2D. -austin -- Austin Haas Pet Tomato, Inc. http://pettomato.com On Thu Jul 24 12:14 , Elliott Slaughter wrote: > Hi, > > I've been working on my game again lately, and one thing I would like to do > is collision detection. To make collision detection sufficiently accurate, I > figure I'll need some sort of pixel perfect algorithm, for which I need > access to the pixels of a surface. Thanks to a previous discussion on this > mailing list, I already know how to do that, but what I *don't* know is how > to find the color key of a surface so I can figure out if a pixel is > transparent or not. There are functions for set-color-key and > clear-color-key but I don't see any get-color-key, and I'm not really sure > how to get it, except by saving the argument passed to load-image and > constructing the color-key manually. > > Also, I think I know a reasonably decent algorithm for collision detection, > but any suggestions on the topic would be appreciated anyways ;-) > > Thanks! > > P.S. I've been wondering why the keyword arguments to load-image are > :key-color and :key-color-at instead of :color-key and :color-key-at (not > that it really matters, it's just a fascinating anomaly). > > -- > Elliott Slaughter > > "Any road followed precisely to its end leads precisely nowhere." - Frank > Herbert > _______________________________________________ > application-builder mailing list > [email protected] > http://www.lispniks.com/mailman/listinfo/application-builder _______________________________________________ application-builder mailing list [email protected] http://www.lispniks.com/mailman/listinfo/application-builder
