Gnat
I like to code in Processing. It does all the hard parts of graphics for you, so you can just concentrate on the coding. I have some back code that will get posted eventually (hopefully) but for now I'm going to share a project that I've been working on recently. Late on night in my room, I wanted to code something but couldn't think of what to code. As I sat there pondering, a gnat was bumbling around in front of my computer screens. I noticed that it had a weird flight pattern. It looked like it almost jumped from one place to another randomly, but with some overall directional sway. I realized this is what I should code, so I did and here is the fruit on my labors. Or at least a relatively stable, version that incorporates a decent amount of features yet still pretty early on in the evolution of the code. It's after the jump (so it doesn't run on load, cause my programs are usually a bit processor intensive)
Source code: gnat
As you can see it's pretty basic, but what I did to make it work was have a "gnat" jump to a random position within a certain range. The position swayed in the direction of the "food" this way the gnat jumps around randomly but with an overall movement towards the food.
Built with Processing
Reader Comments