[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
どうやらネタ切れのようなので、
ソースを公開します。
新潟県のです。
_global.ay = 0;
_global.v = 60;
_global.s = Stage.width / 2 / Math.tan(v / 2 * Math.PI / 180);
var emp: Array = new Array();
var cha: Number = 0;
_global.cl = new Array();
_global.cw = new Array();
_global.cc = new Array();
_global.cp = new Array();
for(i = 0; i < 119; i++){
_global.cp[i] = new Array();
_global.cp[i][3] = 0x000000;
}
_global.cv = new Array();
_global.cl = [
[75, 25, 95],
[50, 25, 30],
[0, 25, 0],
[-25, 25, -45],
[-120, 25, -105],
[-110, 25, -130],
[-90, 25, -115],
[-55, 25, -120],
[-20, 25, -105],
[-10, 25, -135],
[30, 25, -100],
[45, 25, -105],
[50, 25, -45],
[75, 25, -30],
[75, 25, -15],
[95, 25, 5],
[85, 25, 20],
[90, 25, 55],
[110, 25, 65],
[90, 25, 70],
[75, -25, 95],
[50, -25, 30],
[0, -25, 0],
[-25, -25, -45],
[-120, -25, -105],
[-110, -25, -130],
[-90, -25, -115],
[-55, -25, -120],
[-20, -25, -105],
[-10, -25, -135],
[30, -25, -100],
[45, -25, -105],
[50, -25, -45],
[75, -25, -30],
[75, -25, -15],
[95, -25, 5],
[85, -25, 20],
[90, -25, 55],
[110, -25, 65],
[90, -25, 70],
[-35, 25, 70],
[-60, 25, 40],
[-60, 25, 30],
[-50, 25, 30],
[-60, 25, 5],
[-50, 25, 5],
[-25, 25, 35],
[-40, 25, 35],
[-35, -25, 70],
[-60, -25, 40],
[-60, -25, 30],
[-50, -25, 30],
[-60, -25, 5],
[-50, -25, 5],
[-25, -25, 35],
[-40, -25, 35]
];
_global.cw = cl;
for(i = 0; i < cl.length; i++){
_global.cw[i][0] = cl[i][0];
_global.cw[i][1] = cl[i][1] * Math.cos(ax * Math.PI / 180) - cl[i][2] * Math.sin(ax * Math.PI / 180);
_global.cw[i][2] = cl[i][1] * Math.sin(ax * Math.PI / 180) + cl[i][2] * Math.cos(ax * Math.PI / 180);
}
for(i = 0; i < cl.length; i++){
_global.cw[i][0] = cw[i][0] * Math.cos(ay * Math.PI / 180) + cw[i][2] * Math.sin(ay * Math.PI / 180);
_global.cw[i][1] = cw[i][1];
_global.cw[i][2] = - cw[i][0] * Math.sin(ay * Math.PI / 180) + cw[i][2] * Math.cos(ay * Math.PI / 180);
}
_global.cc = [0, 0, 400];
for(i = 0; i < cl.length; i++){
_global.cw[i][0] += cc[0];
_global.cw[i][1] += cc[1];
_global.cw[i][2] += cc[2];
}
for(i = 0; i < 20; i++){
if(i == 4 || i == 14 || i == 17){
_global.cp[i][0] = 12;
_global.cp[i][1] = i;
_global.cp[i][2] = i + 2;
i++;
}else{
_global.cp[i][0] = 12;
_global.cp[i][1] = i;
_global.cp[i][2] = (i == 19) ? (0) : (i + 1);
}
}
_global.cp[20] = [4, 5, 6];
_global.cp[21] = [14, 15, 16];
_global.cp[22] = [17, 18, 19];
for(i = 0; i < 20; i++){
if(i == 24 || i == 34 || i == 37){
_global.cp[i + 23][0] = 32;
_global.cp[i + 23][1] = i + 20;
_global.cp[i + 23][2] = i + 22;
i++;
}else{
_global.cp[i + 23][0] = 32;
_global.cp[i + 23][1] = i + 20;
_global.cp[i + 23][2] = (i == 19) ? (20) : (i + 21);
}
}
_global.cp[44] = [4, 5, 6];
_global.cp[45] = [14, 15, 16];
_global.cp[46] = [17, 18, 19];
for(i = 0; i < 20; i++){
_global.cp[i + 47][0] = i;
_global.cp[i + 47][1] = (i == 19) ? (0) : (i + 1);
_global.cp[i + 47][2] = i + 20;
}
for(i = 0; i < 20; i++){
_global.cp[i + 67][0] = (i == 19) ? (0) : (i + 1);
_global.cp[i + 67][1] = i + 20;
_global.cp[i + 67][2] = (i == 19) ? (20) : (i + 21);
}
for(i = 0; i < 8; i++){
_global.cp[i + 87][0] = 47;
_global.cp[i + 87][1] = i + 40;
_global.cp[i + 87][2] = (i == 7) ? (40) : (i + 41);
}
for(i = 0; i < 8; i++){
_global.cp[i + 95][0] = 55;
_global.cp[i + 95][1] = i + 48;
_global.cp[i + 95][2] = (i == 7) ? (48) : (i + 49);
}
for(i = 0; i < 8; i++){
_global.cp[i + 103][0] = i + 40;
_global.cp[i + 103][1] = (i == 7) ? (40) : (i + 41);
_global.cp[i + 103][2] = i + 48;
}
for(i = 0; i < 8; i++){
_global.cp[i + 111][0] = (i == 7) ? (40) : (i + 41);
_global.cp[i + 111][1] = i + 48;
_global.cp[i + 111][2] = (i == 7) ? (48) : (i + 49);
}
onEnterFrame = function()
{
_root.clear();
_global.cw = cl;
_global.cl = [
[75, 25, 95],
[50, 25, 30],
[0, 25, 0],
[-25, 25, -45],
[-120, 25, -105],
[-110, 25, -130],
[-90, 25, -115],
[-55, 25, -120],
[-20, 25, -105],
[-10, 25, -135],
[30, 25, -100],
[45, 25, -105],
[50, 25, -45],
[75, 25, -30],
[75, 25, -15],
[95, 25, 5],
[85, 25, 20],
[90, 25, 55],
[110, 25, 65],
[90, 25, 70],
[75, -25, 95],
[50, -25, 30],
[0, -25, 0],
[-25, -25, -45],
[-120, -25, -105],
[-110, -25, -130],
[-90, -25, -115],
[-55, -25, -120],
[-20, -25, -105],
[-10, -25, -135],
[30, -25, -100],
[45, -25, -105],
[50, -25, -45],
[75, -25, -30],
[75, -25, -15],
[95, -25, 5],
[85, -25, 20],
[90, -25, 55],
[110, -25, 65],
[90, -25, 70],
[-35, 25, 70],
[-60, 25, 40],
[-60, 25, 30],
[-50, 25, 30],
[-60, 25, 5],
[-50, 25, 5],
[-25, 25, 35],
[-40, 25, 35],
[-35, -25, 70],
[-60, -25, 40],
[-60, -25, 30],
[-50, -25, 30],
[-60, -25, 5],
[-50, -25, 5],
[-25, -25, 35],
[-40, -25, 35]
];
for(i = 0; i < cl.length; i++){
_global.cw[i][0] = cl[i][0];
_global.cw[i][1] = cl[i][1] * Math.cos(ax * Math.PI / 180) - cl[i][2] * Math.sin(ax * Math.PI / 180);
_global.cw[i][2] = cl[i][1] * Math.sin(ax * Math.PI / 180) + cl[i][2] * Math.cos(ax * Math.PI / 180);
}
for(i = 0; i < cl.length; i++){
_global.cw[i][0] = cw[i][0] * Math.cos(ay * Math.PI / 180) + cw[i][2] * Math.sin(ay * Math.PI / 180);
_global.cw[i][1] = cw[i][1];
_global.cw[i][2] = - cw[i][0] * Math.sin(ay * Math.PI / 180) + cw[i][2] * Math.cos(ay * Math.PI / 180);
}
for(i = 0; i < cl.length; i++){
_global.cw[i][0] += cc[0];
_global.cw[i][1] += cc[1];
_global.cw[i][2] += cc[2];
}
for(i = 0; i < cw.length; i++){
_global.cv[i] = [s * cw[i][0] / cw[i][2], s * cw[i][1] / cw[i][2]];
}
do{
cha = 0;
for(i = 0; i + 1 < cp.length; i++){
if(Math.sqrt(Math.pow((cw[cp[i][0]][0] + cw[cp[i][1]][0] + cw[cp[i][2]][0]) / 3, 2) + Math.pow((cw[cp[i][0]][1] + cw[cp[i][1]][1] + cw[cp[i][2]][1]) / 3, 2) + Math.pow((cw[cp[i][0]][2] + cw[cp[i][1]][2] + cw[cp[i][2]][2]) / 3, 2)) < Math.sqrt(Math.pow((cw[cp[i + 1][0]][0] + cw[cp[i + 1][1]][0] + cw[cp[i + 1][2]][0]) / 3, 2) + Math.pow((cw[cp[i + 1][0]][1] + cw[cp[i + 1][1]][1] + cw[cp[i + 1][2]][1]) / 3, 2) + Math.pow((cw[cp[i + 1][0]][2] + cw[cp[i + 1][1]][2] + cw[cp[i + 1][2]][2]) / 3, 2))){
emp = cp[i];
_global.cp[i] = cp[i + 1];
_global.cp[i + 1] = emp;
cha++;
}
}
}while(cha > 0);
for(i = 0; i < cp.length; i++){
_root.beginFill(cp[i][3]);
_root.lineStyle(0, cp[i][3]);
_root.moveTo(cv[cp[i][0]][0] + Stage.width / 2, Stage.height / 2 - cv[cp[i][0]][1]);
_root.lineTo(cv[cp[i][1]][0] + Stage.width / 2, Stage.height / 2 - cv[cp[i][1]][1]);
_root.lineTo(cv[cp[i][2]][0] + Stage.width / 2, Stage.height / 2 - cv[cp[i][2]][1]);
_root.lineTo(cv[cp[i][0]][0] + Stage.width / 2, Stage.height / 2 - cv[cp[i][0]][1]);
_root.endFill();
}
/*for(i = 0; i < cp.length; i++){
_root.lineStyle(1, 0x000000);
_root.moveTo(cv[cp[i][0]][0] + Stage.width / 2, Stage.height / 2 - cv[cp[i][0]][1]);
_root.lineTo(cv[cp[i][1]][0] + Stage.width / 2, Stage.height / 2 - cv[cp[i][1]][1]);
_root.lineTo(cv[cp[i][2]][0] + Stage.width / 2, Stage.height / 2 - cv[cp[i][2]][1]);
_root.lineTo(cv[cp[i][0]][0] + Stage.width / 2, Stage.height / 2 - cv[cp[i][0]][1]);
}*/
if(Key.isDown(Key.UP))
{
_global.cc[2] += 10;
}
if(Key.isDown(Key.DOWN))
{
_global.cc[2] -= 10;
}
if(Key.isDown(Key.LEFT))
{
_global.cc[0] -= 10;
}
if(Key.isDown(Key.RIGHT))
{
_global.cc[0] += 10;
}
if(Key.isDown(Key.PGUP))
{
_global.cc[1] += 10;
}
if(Key.isDown(Key.PGDN))
{
_global.cc[1] -= 10;
}
};
onMouseDown = function()
{
dn = true;
mx = _root._xmouse;
my = _root._ymouse;
};
onMouseUp = function()
{
dn = false;
};
onMouseMove = function()
{
if(dn){
if(_root._xmouse > mx){
_global.ay -= 4;
}else if(_root._xmouse < mx){
_global.ay += 4;
}
mx = _root._xmouse;
if(_root._ymouse > my){
_global.ax -= 4;
}else if(_root._ymouse < my){
_global.ax += 4;
}
my = _root._ymouse;
}
};
結構長いですね。
ちなみに_globalなのは、
外から数値を変えられるようにです。
やはり汚く、しかも長いので、
少し直したいと思います。