Hi everybody!
I just want to know why are the left and right buttons working and the up and down not?
The key arrow buttons work all four.
I tried changing the var movement to another place and the buttons work but I can’t make them stop.
Is there any tutorial I need to read about or is there a specific name to look for it on the web?
Any comment would be nice!
Thank you in advanced!
walkAround = function () {
left.onPress = function() {
this.onEnterFrame = function() {
cameraView.rotation -= .05;
};
};
left.onRelease = function() {
delete this.onEnterFrame;
};
if (Key.isDown(Key.LEFT)) {
cameraView.rotation -= .05;
}
right.onPress = function() {
this.onEnterFrame = function() {
cameraView.rotation += .05;
};
};
right.onRelease = function() {
delete this.onEnterFrame;
};
if (Key.isDown(Key.RIGHT)) {
cameraView.rotation += .05;
}
movement = 0
up.onPress = function() {
this.onEnterFrame = function() {
_root.movement -= 30;
};
};
up.onRelease = function() {
delete this.onEnterFrame;
};
down.onPress = function() {
this.onEnterFrame = function() {
_root.movement += 30;
};
};
down.onRelease = function() {
delete this.onEnterFrame;
};
if (Key.isDown(Key.UP)) {
_root.movement -= 30;
}
if (Key.isDown(Key.DOWN)) {
_root.movement += 30;
}
cameraView.x += Math.sin(cameraView.rotation)*_root.movement;
cameraView.z += Math.cos(cameraView.rotation)*_root.movement;
for (var i = 0; i<objectsInScene.length; i++) {
objectsInScene*.display();
}
};
theScene.onEnterFrame = walkAround;