General purpose use. On Wed, Nov 28, 2012 at 5:38 AM, Yaron Minsky <ymin...@gmail.com> wrote: > Is this oriented towards educational use, or is it a more > general-purpose library? > > y > > On Tue, Nov 27, 2012 at 10:51 PM, Jay McCarthy <jay.mccar...@gmail.com> wrote: >> And if you don't want to write your own... >> >> I have a Planet package or github repo for almost everything... >> >> (old) slow functional physics in Racket --- >> https://github.com/jeapostrophe/pfp/blob/master/example.ss >> >> (old) interface to fast Chipmunk library --- >> https://github.com/jeapostrophe/chipmunk/ >> >> my current system in pure Racket with a broad phase / narrow phase >> distinction: https://github.com/get-bonus/get-bonus/tree/master/gb/physics >> >> Personally, I think you should use this opportunity to teach your kid >> the Pythagorean Theorem, like the Boostrap curriculum teaches: >> http://www.bootstrapworld.org/materials/ >> >> Jay >> >> On Tue, Nov 27, 2012 at 8:37 PM, Stephen Bloch <bl...@adelphi.edu> wrote: >>> >>> On Nov 27, 2012, at 8:56 PM, 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. >>> >>> Right, and the question doesn't even make sense at the "image" level >>> because images don't have locations. >>> >>> One "purist" answer would be to write your own collision detection, based >>> on whatever data type you're using for your model. If it has two fields >>> "player-posn" and "monster-posn", you can do a distance formula calculation >>> to find out how close those two points are to one another, and decide >>> whether it's close enough to constitute a "collision". If it has a list of >>> posns (or structs that contain posns), you can do that for each pair of >>> elements in the list. >>> >>> But that's a pain, however much one might learn from the process. If you >>> just want to get a game with collision detection up and running, it would >>> be nice if the image and/or universe libraries provided some support. An >>> easy example would be rects-intersect?: call it on the bounding rectangles >>> of your two translated images, and it tells you whether they intersect. (A >>> student could write that easily enough, and use it henceforth.) Spiffier, >>> in case you wanted to treat irregularly-shaped objects properly, would be a >>> function images-intersect? that takes in two translated images and tells >>> whether there is a pixel location for which both have nonzero alpha >>> channels. >>> >>> How do you represent a "translated image"? It could be an image and a >>> posn, or it could be just an image formed by place-image onto an >>> all-transparent background. >>> >>>> 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. >>> >>> And vice versa, of course: there are lots of things that are easy in >>> universe, but very difficult in Scratch. >>> >>> >>> Stephen Bloch >>> sbl...@adelphi.edu >>> >>> >>> ____________________ >>> Racket Users list: >>> http://lists.racket-lang.org/users >> >> >> >> -- >> Jay McCarthy <j...@cs.byu.edu> >> Assistant Professor / Brigham Young University >> http://faculty.cs.byu.edu/~jay >> >> "The glory of God is Intelligence" - D&C 93
-- Jay McCarthy <j...@cs.byu.edu> Assistant Professor / Brigham Young University http://faculty.cs.byu.edu/~jay "The glory of God is Intelligence" - D&C 93 ____________________ Racket Users list: http://lists.racket-lang.org/users