Chris Armstrong

Archive for the ‘Projects’ Category

Pan and Zoom

Get Adobe Flash player

I thought adding camera control would be a lot harder than it turned out to be. Turns out the basic principle is pretty simple; create a container sprite (‘camera’) for all the objects in the game world, then modify it’s position/scale etc to give the impression of panning and zooming.

I’ve created a seperate ‘Camera’ class for this, with ‘pan’ and ‘zoom’ as public functions, giving me a bit more flexibility as to where I can manipulate the camera.

Thanks to this video for explaining the concept.

Let there be lines

Get Adobe Flash player

Time to make these colours mean something. And also… outlines!

Mouse Control

Get Adobe Flash player

Experimenting with using a gravitational pull on the cursor to control the player (triangle).

Also improved the collision detection a little so the shapes don’t overlap, however it’s still pretty sloppy.

Ecosystem

Get Adobe Flash player

Hmm… not really what I was hoping for.

The idea here is for each shape to have its own attraction/repulsion system, being attracted to shapes with more sides, and repulsed from shapes with less sides… I was hoping it would create a dynamic system of constantly moving shapes, chasing each other and being chased, but so far it’s just resulting in shapes being clumped together.

I think its a case of messing around with each shape’s impulse formula till I get the effect I want.

Now with added magnetism

Get Adobe Flash player

Using the ApplyImpulse function in Box2D to create a magnetic field around the cursor.

Leave a comment if you’re interested in seeing some of the code behind this.