Pages to see:
« Color Quickie | Main | First! »


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)

This browser does not have a Java Plug-in.
Get the latest Java Plug-in here.


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


PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>