xxxxxxxxxx
45
class Character {
constructor() {
this.x = 0;
this.y = 0;
this.z = 0;
this.speed = 10;
}
show() {
push();
translate(this.x, this.y, this.z);
box(50);
// just to know the orientation i am in
stroke("red");
strokeWeight(5);
line(0, 0, 0, 200, 0, 0);
stroke("green");
strokeWeight(5);
line(0, 0, 0, 0, 200, 0);
stroke("blue");
strokeWeight(5);
line(0, 0, 0, 0, 0, 200);
// helps with orientation
texture(chess);
plane(500);
pop();
}
move() {
if (keyIsDown(LEFT_ARROW)) {
this.x += 50;
}
if (keyIsDown(RIGHT_ARROW)) {
this.x -= 50;
}
if (keyIsDown(UP_ARROW)) {
this.y += 50;
}
if (keyIsDown(DOWN_ARROW)) {
this.y -= 50;
}
}
}