making a 2007 JVM more like a C=64

kirkjerk's picture

So one disadvantage I have when I use Processing instead of KNP is not having a good sprite class. It's easy enough to put an image or a box anywhere on screen, but collision detections have been a pain in the ass. Also, there's some part of me saying that bounding-rectangle collisions might end up being too limiting. So I want to add a reasonable sprite class to my arsenal before sitting down to KotM.

First attempt is this:
http://kirkjerk.com/features/java/dev/sprat1/

I've decided I'm making sprats instead of sprites. It's catchy and one less letter to type.

geek notes, it first does bounding rectangle comparisons, and then pixel by pixel "alpha channel" comparison, so a transparent gif (or PNG I think, haven't tried) will do what you expect. Then I threw in the idea of manual multiple frames, since a collision algorithm will have to know about that.

I now want to make a "basic physics" sprat, w/ a bit of intertia and what not, the kind of thing that ends up being in at least half of my 'wrecks.

If all goes well I'm going to port one of my old visual basic programs as a proof of concept.

If all goes really well, I'll start seeing about a very basic platform engine.

(I think the biggest bummer with KNP is how few options you have for enemy movement. I kinda wish they put on some basic "Platform" and "8 direction" or whatever movement.)

AND BE WARNED -- I JUST FOUND A KICK ASS SOUND ENGINE FOR KNP^H^H^Hjava processing - sorry for the confusion SO MY KOTMS WILL BE EMERGING FROM THE MIME-LIKE, SILENT GHETTO THEY'VE BEEN SITTING IN FOR SO LONG. Hell, I think THIS engine even understands MP3s! (though I don't think it does any kind of streaming, so I'm kind of afraid of it.)

AttachmentSize
boundaries2.pde_.txt3.3 KB

Comments

zum's picture

This is sexy. Please

This is sexy. Please continue!

ALSO PLEASE TO BE SHARING SOUND ENGINE SIR IT IS OF CRITICAL IMPORTANCE

kirkjerk's picture

Oh, DAMN I was totally

Oh, DAMN I was totally lying. I made a horrendous brain-o. I don't have a KNP sound engine. I have one for Java processing.

My *Java games* were silent-- my KNP made decent use of sounds for the most part, though I understand the limitations on # of sounds going at once.

If anyone cares, for Processing it's just the "Minim" engine, simple use of "AudioSnippet", especially the notion of hitting .rewind() before every .play().

Sorry to get any hopes up

kirkjerk's picture

it's like physics, only lamer and shakier

So:
http://kirkjerk.com/features/java/dev/sprat2/

a little more physicsy. This time use arrow keys for left and right, and space for a jetpak like thrust.

Obviously needs work, I might have to reconsider how I do "landing".

But it has potential. And is scarily similar to some ideas I have for Kliksmas.
(If it wasn't the holiday theme I'd be remaking InterGalactic SpaceMan BlastFest)

I'm worried I'm getting dumber over time, so I'm a little heartened that I think the collision/rebound management came together in a less cheaty way then it did back in the day.

Freshest concept, repositioning after collision, so things don't get stuck on each other: realizing that in practice I only care about one "kind" of collision at a time, horizontal or vertical, so I just peek and see which overlap is less, and that's where they "push" each other apart

Also: I figured out a decent keyboard reading routine, so I can effectively poll "is this key down?" rather than responding to key downs only.

AttachmentSize
boundaries2.txt6.9 KB