Viktor Hesselbom

Viktor Hesselbom

« Go back home

Achtung die Processing

A couple of weeks ago I started looking into Processing. It's pretty interesting because you can get visual results immediately when trying it. It's not something I will continue to use because it's more geared towards people new to programming (great place to start btw!) but I quickly whipped out an easy clone of the game Acthung, die Kurve!

You can try it out at http://hesselboom.com/achtung/. This version is only for 2 players and the controls are the left and right arrow keys for one player and A and D for the second.

The source code for the game can be found here and the fonts used can be found here. As you can see it's very little code required because you don't really have to setup much, you can immediately start drawing.

I handled the hit detection by storing each pixel in a 2d boolean array and each iteration check if the new position of each snake is true in the array. And if it is, that snake should "die" and when there is only one snake left give that snake a point. It's not 100% perfect because once or twice it might miss a pixel because it doesn't necessarily move 1 pixel up or down each iteration because the new position is calculated based on rotation, but it's good enough and you rarely spot that error.