[racket] Doing collision detection in universe.ss
On Tue, Nov 27, 2012 at 08:56:13PM -0500, Yaron Minsky wrote:
> I've been weaning my son off of Scratch in favor of Racket, and trying
> to get him to write interactive games using universe.ss and image.ss.
> I'm wondering if anyone has suggestions for how to do things like
> collision detection. image.ss has these nice first-class images, but
> I don't see a good way of querying two images to see if they overlap.
>
> Has anyone else had luck in doing this? universe has a nice
> programming model, but I've found it challenging to find simple ways
> of doing the kinds of things that Scratch makes easy.
There are two arts to collision detection: figuring out whether two
images collide (which gets trickier when they're in motion) and
organising all your objects so you don't have to test very many
combinations of them.
Both of these can get quite complicated, and are susceptible to
nontrivial, complicated, and often necessary efficiency improvements
depending on special properties of the game.
A one-size-fits-all solution may be good enough for tinkering with, but
serious use may well need serious hacking.
-- hendrik