[as3/cs3] Squid simulation

Hi guys,
I was curious if anyone has any idea of how to implement the following:

Essentially I am creating a game/site in which a squid follows your mouse and you interact with the website using the squid. I currently have got all the action script in place that controls the squid's direction and moves the squid around... However its fairly static and the squid is currently only a simply drawing. What I would like to do is change my code so that it works with box2dflash, and then somehow make the different parts of the squid separate so they can behave realistically. Stuff like the tentacles moving around depending on movement, simple collision detection, etc. The problem is that... Well I have no idea how to do this or even how to start. Its a bit of a big project I am taking on, and so I am hoping someone much better with as3 and flash physics can help. 🙂

Anyways, here is what I got so far: http://www.2dsquid.com/alpha (click to make the squid move faster, move mouse to control squid)

And here is my squid logic:

Code:
function updatePosition():void {         
         //Set Up
         var distance = Math.sqrt(Math.pow(dx, 2)+Math.pow(dy, 2));
         
         previousX = x;
         previousY = y;
         
         //Rotation Handling
         var radians:Number=Math.atan2(dy,dx);         
         var rotateTo:Number = (radians/Math.PI)*180;
         
         if (rotateTo < rotation && rotateTo + 360 - rotation < rotation - rotateTo) {
            rotateTo += 360;
         } else if (rotateTo > rotation && rotation + 360 - rotateTo < rotateTo - rotation) {
            rotateTo -= 360;
         }
         
         var dr = rotateTo - rotation;
         
         if(!testRotation) { rotation = 90; testRotation = true; }
         else if(rotation != rotateTo) rotation += dr/rotationSpeed;
         
         //Direction Calc
         var rad = rotation * Math.PI/180;
         var someX = Math.cos(rad)*distance;
         var someY = Math.sin(rad)*distance;
         
         if(distance > 200){
            someX += Math.cos(distance*Math.PI/180) * 100 * distance/700;
            someY += Math.sin(distance*Math.PI/180) * 80 * distance/700;
         }
         
         //Movement
         x += someX/speed;
         y += someY/speed;

         //Bounce Adjusting
         if(radius > 1) radius -= .1;
         if(distance < 30 && radius < fixedRadius) {
            if(radiusAdjust > 1) { radiusAdjust -= 1 }
            radius += radiusAdjust;
         }
         
         x -= Math.cos(-rad) * radius;
         y += Math.sin(-rad) * radius;
         
         //End Step Stuff
         
         if((previousX != x || previousY != x) && !goingFast) status = 2;
         else if((previousX != x || previousY != x) && goingFast) status = 3;
         else status = 1;
         
         blurSquid();
         updateStatus();
      }


Thanks so much to anyone who can help me!! 🙂
Try making simpler things first following example setups you can find on the net, then refer to the manual on how to use stuff like joints. Your current setup doesn't relate to getting Box2d to work.
For a squid you'll want to have a whole lot of angular constraints for each joint with a motor.

Original thread: https://box2d.org/forum/viewtopic.php?t=531