#pragma strict
var MyCube = function MyCube() {
var positionX : int;
var positionY : int;
var positionZ : int;
};
function Update () {
Transform.position.X = MyCube.positionX;
Transform.position.Y = MyCube.positionY;
Transform.position.Z = MyCube.positionZ;
if(Input.getKey("q")) {
MyCube.positionX = MyCube.positionX + 1;
}
if(Input.getKey("a")) {
MyCube.positionX = MyCube.positionX - 1;
}
if(Input.getKey("w")) {
MyCube.positionY = MyCube.positionY + 1;
}
if(Input.getKey("s")) {
MyCube.positionY = MyCube.positionY - 1;
}
if(Input.getKey("e")) {
MyCube.positionZ = MyCube.positionZ + 1;
}
if(Input.getKey("d")) {
MyCube.positionZ = MyCube.positionZ - 1;
}
}
I can't seem to find the error in my code![alt text][1]
The semicolon 7 is supposed to be there because it is a variable with a function inside.
This code is in javascript.
[1]: /storage/temp/22449-screen+shot+2014-02-19+at+6.33.27+pm.png
↧