[Source] 3d iso vehicle engine

Heya Kirupians, here is a little 3d isometric vehicle engine, I hope you’ll like it :slight_smile:

Example : here

Source also downloadable : here

Commands :
Enter- Show/Hide dots
Page Up/Down- Increase/Decrease size
Home/End- Change Y splines level
Arrows- Move

 
  /***************************************************************
  *                                                              *
  *  16/04/2007 - Isometric moving vehicle, '3d' trigo based -   *
  *  By Julien Wehrbach aka Zappan http://zappan.deviantart.com  *
  *  Use it freely, not for sale, please just quote me :         *
  *  Julien Wehrbach - Zappan - http://zappan.deviantart.com     *
  *  ask me for any question on zappan.net@gmail.com             *
  *                                                              *
  ***************************************************************/

var deg:Number = 0;
var rDeg:Number = 2;
var dMov:Number = deg-70;
var speed = 0;
var maxSpeed = 15;

c1 = _root.createEmptyMovieClip("car_mc", _root.getNextHighestDepth());

dots = new Array("uc1", "uc2", "uc3", "uc4", "uc5",
         "uc6", "uc7", "uc8", "uc9", "uc10",
         "uc11", "uc12", "uc13", "uc14", "uc15");

cx = new Array(0, 40, 180, 200, 220,
           0, 40, 180, 200, 220,
           0, 40, 180, 200, 220);

cy = new Array(0, 40, 180, 200, 220,
           0, 40, 180, 200, 220,
           0, 40, 180, 200, 220);

ellipse = new Array(60, 60, 60, 70, 60,
            60, 60, 60, 70, 60,
            60, 60, 60, 70, 60);

Ydecal = new Array(0, 0, 0, 0, 0,
           10, 10, 10, 10, 10,
           20, 20, 20, 20, 20);

makePoints(c1, dots, cx, cy, ellipse, Ydecal, Stage.width/2, Stage.height/2);

function makePoints(target:MovieClip, dots:Array, cx:Array, cy:Array, ellipse:Array, Ydecal:Array, initX:Number, initY:Number):Void {
    for (i=0; i<dots.length; i++) {
        this[dots*] = target.createEmptyMovieClip(dots*, i+1);
        this[dots*].lineStyle(3, 0x0000FF, 100);
        this[dots*].moveTo(0, 0);
        this[dots*].lineTo(4, 4);
        this[dots*].moveTo(4, 0);
        this[dots*].lineTo(0, 4);
    }
    target._x = initX;
    target._y = initY;
    target.dots = dots;
    target.cx = cx;
    target.cy = cy;
    target.ellipse = ellipse;
    target.Ydecal = Ydecal;
    target.onEnterFrame = wired;
}

function wired():Void {
    dMov = deg-160;
    vX = Math.cos(dMov*Math.PI/180)*speed;
    vY = Math.sin(dMov*Math.PI/180)*speed/2;
    speed -= (speed>0) ? 0.5 : 0;
    speed += (speed<0) ? 0.5 : 0;
    if (speed>2 || speed<-2) {
        if (Key.isDown(Key.LEFT)) {
            deg -= (deg>0) ? speed/rDeg : -360;
        }
        if (Key.isDown(Key.RIGHT)) {
            deg += (deg<360) ? speed/rDeg : -360;
        }
    }
    if (Key.isDown(Key.UP)) {
        speed += (speed<maxSpeed) ? 1 : 0;
    }
    if (Key.isDown(Key.DOWN)) {
        speed -= (speed>-maxSpeed) ? 1 : 0;
    }
    this._x += vX;
    this._y += vY;
    tmp = this.createEmptyMovieClip("tmp", -1);
    tmp.lineStyle(1, 0x000000, 100);
    tmp.moveTo(this[dots[0]]._x+this[dots[0]]._width/2, this[dots[0]]._y+this[dots[0]]._height/2);
    j = 0;
    for (i=0; i<this.dots.length; i++) {
        if(temp != undefined && temp != this.Ydecal*){
            tmp.lineTo(this[dots[j]]._x+this[dots[j]]._width/2, this[dots[j]]._y+this[dots[j]]._height/2);
            tmp.moveTo(this[dots*]._x+this[dots*]._width/2, this[dots*]._y+this[dots*]._height/2);
            j = i;
        }
        tX = Math.cos((deg+this.cx*)*Math.PI/180)*this.ellipse*;
        tY = Math.sin((deg+this.cy*)*Math.PI/180)*this.ellipse*/2;
        this[dots*]._x = tX;
        this[dots*]._y = tY-this.Ydecal*;
        tmp.lineTo(this[dots*]._x+this[dots*]._width/2, this[dots*]._y+this[dots*]._height/2);
        temp = this.Ydecal*;
    }
    tmp.lineTo(this[dots[j]]._x+this[dots[j]]._width/2, this[dots[j]]._y+this[dots[j]]._height/2);
}