Asteroids Spaceship

One of the “trignometry + forces” exercises from my upcoming Nature of Code book is to implement in Processing the spaceship from asteroids. Here’s a solution!

Source: _03_asteroids.zip

  • http://projects.nihongoresources.com Mike Kamermans

    Hmm, is the code supposed to make the ship stop turning when you hit ‘z’ while having either the left or right arrow key pressed?

  • http://www.shiffman.net Daniel

    This is a simple example, just allows one keypress at a time. You’d have to be fancier and use something like keyPressed() and keyReleased(), boolean variables, etc. to allow for more than one keypress. The point of the example isn’t the interaction, it’s the polar to cartesian math for force calculation.

  • Anonymous

    This is a simple example, just allows one keypress at a time. You’d have to be fancier and use something like keyPressed() and keyReleased(), boolean variables, etc. to allow for more than one keypress. The point of the example isn’t the interaction, it’s the polar to cartesian math for force calculation.

  • Bj Schmidt

    Sorry, I can’t download the Sourcecode. I’m still trying to learn proccessing.

  • Anonymous

    Whoops, sorry, I fixed the broken link!