In the game you get to control a deep sea bio-luminescent creature that is formed from two orbs and a membrane. The creature eats plankton by enveloping it inside it’s membrane.
There were a couple of innovations we managed fit into the game. The first I will detail here, the other will be in my next post.
(i) We needed to make the membrane behave like a ribbon under water:
I’m a huge fan of Box2D, and have done a few AS3 rope experiments. To get the behaviour I wanted, I figured that I could chain together a series of balls within Box2D, turn off the gravity for the top-down underwater view effect. This way I could detect collisions and if all creatures have mass within the physics engine they would interact correctly with the membrane.
(1) Create a chain out of box2D circles.
(2) Link the chain circles using revolute joints.
(3) Draw membrane/rope by drawing from joint point to joint point and add orb sprite.
(4) Remove rendering of circles.
The source is available for this game here.
(Obviously it was a rush job so expect a lot of code imperfection.)