Second non-demo project work.
/* * Audin Malmin * 4-26-98 * Java/OS week 4. * * This week has seen some real progress. I have (I hope) eradicated the race * conditions which were plaguing me last week. * * Current layout: * * ColonyApplet --+ * | * Frame --+ * | * DrawPanel --+--------+--------+---------+ * | | | | * DudeList DudeList PopupMenu PopupMenu * | | | | * Dude | Dude | * | | * DudeUpdate* | * | * DudeUpdate* * * So basically, DrawPanel is the main program loop. It sets everything up and * handles events. DrawPanel contains two popup menus and two DudeList objects. * * DudeList is kind of a mutant linked list container. It does contain a linked list * of Dude objects. In addition it contains a DudeUpdate object. * * DudeUpdate is a thread. It's job is to animate each of the Dudes. Basically it * runs through the linked list on it's own (it gets a pointer to the "first" Dude * object), calling the Dude.move() function for each one. The DudeUpdate constructor * also gets a pointer to the main DrawPanel object, so that it can get ahold of the * Graphics Context and the background color. * * So what does it all do??????????????? * * * It compiles and runs. * * * Left-clicking on the screen will create one red Dude directly under the mouse * cursor, and one blue Dude will be created randomly somewhere else. * * * The Dudes (both red and blue) will move around the window, bouncing off the * edges. * * * The Dudes will vary slightly in color. (Ie: all red dudes are red, but some are * brighter and some are darker.) * * * Right-clicking on an unoccupied section of screen you will get a popup menu * with a list of acts you can perform on the general area. These acts will have * a circle of influance on which they will be active. They will also most likely * "taint" the area with an aura of fear. (ie: the Dudes should try to stay away * from these areas.) * * * Right-clicking in a small area around a Dude will give you a popup menu with both * the normal options and acts you can inflict on the Dude itself. The menu also * gives you the Dude's number. Currently the only working option is "Mutate", which * causes the dude to double in size. * * So what doesn't it do??? * * * You can't currently kill a Dude. This isn't hard to add, though. * * * There's a problem with erasing the first drawing of a Dude...so you get some * fluff left over on the background. */
The source code.
The Live demo.