Wednesday, April 23, 2008

Project 2: Swarm and Gravitate

In this program, I started learning the basic flow of the Windows Forms program. I did some event handling and some graphics, learned some more stuff that C# makes retarded easy (the List container, primarily), and did some really simple math (that took a little too long to figure out--it's been too long since I've taken math. Or physics.)

Swarm() calculates the center position of the collection of bodies and everybody accelerates towards that position. Gravitate() attracts the bodies to one another by (something resembling) gravity. This is all, of course, 2D.

Things I'd like to add:

  • Hitting tab to center on a body doesn't properly work. I need to fix that.
  • Once that works, I'd like to be able to double click on a position to center on that point.
  • There is no consequence of collisons--gravity simply turns off when the bodies are about to touch (to keep them both from rocketing off into space).
  • It'd be nice to put in a menu to add / delete planetary bodies.
  • It'd be nice to put in controls to drive around one of the planets.
If I can think of anything else to add, I'll add it. I'm planning on moving on to a simple game next. Don't think I'm going to mess with DirectX yet, think I'll do something hands-on and 2D before I start messing around with the XNA toolkit.

Here's the source file.

No comments: