Pages: 1
Topic closed
var zP;
var xP;
var yP;
var xC;
var yC;
var caX;
var caZ;
var caRH;
// camera rotation (horizontal) ^_^
var size;
var map = new Array();
map.push(new Array());
map.push(new Array());
map.push(new Array());
map[0].push("1");
map[0].push("1");
map[0].push("1");
map[0].push("1");
map[1].push("1");
map[1].push("1");
map[1].push("1");
map[2].push("1");
map[2].push("1");
map[2].push("1");
map[2].push("1");
map[2].push("1");
trace(map);
trace(map[0][0]);
trace(map[0][1]);
trace(map[1][1]);
trace(map[2][4])
trace(map[2][5])
trace("---");
//s = size
//ca = camera
function onLoad() {
this.createEmptyMovieClip("cube",this.getNextHighestDepth());
this.createEmptyMovieClip("cube",this.getNextHighestDepth());
cube.lineStyle(1,0x00FF00,100,true,"none","round","miter",1);
moveX = 0;
moveZ = 0;
size = 32;
trace(map[0][1]);
}
function onEnterFrame() {
cube.clear();
cube.lineStyle(0.5,0x00FF00,100,true,"none","round","miter",1);
if (Key.isDown(Key.UP)) {
moveZ -= 1;
}
if (Key.isDown(Key.RIGHT)) {
moveX -= 1;
}
if (Key.isDown(Key.DOWN)) {
moveZ += 1;
}
if (Key.isDown(Key.LEFT)) {
moveX += 1;
}
j = -1;
while (j<map.length) {
trace(i);
j++
trace(map[1][i]);
i = 0
while (i<map[j].length) {
trace(i);
if ((map[j][i] == 1) && (50+(16*j)+moveZ>1)) {
xP = 0+(i*32)+moveX;
yP = 50;
zP = 50+(16*j)+moveZ;
xP -= size/2;
yP -= size/2;
convert();
cube.moveTo(xC,yC);
xP += size;
yP += 0;
zP += 0;
convert();
cube.lineTo(xC,yC);
xP += 0;
yP += size;
zP += 0;
convert();
cube.lineTo(xC,yC);
xP -= size;
yP += 0;
zP += 0;
convert();
cube.lineTo(xC,yC);
xP += 0;
yP -= size;
zP += 0;
convert();
cube.lineTo(xC,yC);
xP += 0;
yP += 0;
zP += size/2;
convert();
cube.lineTo(xC,yC);
//SECOND LAYER!
convert();
xP += size;
yP += 0;
zP += 0;
convert();
cube.lineTo(xC,yC);
xP += 0;
yP += size;
zP += 0;
convert();
cube.lineTo(xC,yC);
xP -= size;
yP += 0;
zP += 0;
convert();
cube.lineTo(xC,yC);
xP += 0;
yP -= size;
zP += 0;
convert();
cube.lineTo(xC,yC);
//*********************************************************
yP += size;
zP -= 0;
convert();
cube.moveTo(xC,yC);
yP += 0;
zP -= size/2;
convert();
cube.lineTo(xC,yC);
yP += 0;
xP += size;
zP -= -size/2;
convert();
cube.moveTo(xC,yC);
yP += 0;
zP -= size/2;
convert();
cube.lineTo(xC,yC);
yP -= size;
xP += 0;
zP -= -size/2;
convert();
cube.moveTo(xC,yC);
yP += 0;
zP -= size/2;
convert();
cube.lineTo(xC,yC);
/*first cube done
^.^"
*/
}
i++;
}
}
trace("done");
}
function convert() {
xC = (xP*(200/zP))-(-300);
yC = (yP*(200/zP))-(-200);
}Yeah... I need help figuring out how to change camera rotation according to caRH (camera rotation horizontal). I've pretty much given up on trying, having a cold isn't helping.
Anyone know how to do this? Don't tell me to google it, that never helps...
Offline
umm....... what programing language is it????
probably, you should convert the program into a scratch project, so that we can understand it better.
if you need my help, just comment on any of my projects.
Offline
gah this hurts my brain
Offline
Turn it into a scratch project... ROFL.
Ok first, give scratch 2D arrays.
Then, make loops actually work right.
After that, make saving.
And so much more...
Ok, here's the ONE thing I need:
I need a formula that takes...
-Original X position
-Original Z position
And according to camera rotation, changes the X and Z values...
Offline
Good gosh, i say java script? lol ,im wrong
Offline
Actionscript 2.
Anyone look at the title?
Offline
Topic closed
Pages: 1