Control Update
This commit is contained in:
parent
6e7cf9166c
commit
45769a6906
22
Script.js
22
Script.js
@ -34,17 +34,17 @@ function init() {
|
||||
}
|
||||
|
||||
function keyDownPressed(e) {
|
||||
if (e.keyCode == 81) {
|
||||
if (e.keyCode == 87) {
|
||||
keys.up = true;
|
||||
} else if (e.keyCode == 65) {
|
||||
} else if (e.keyCode == 83) {
|
||||
keys.down = true
|
||||
}
|
||||
|
||||
if (e.keyCode == 79) {
|
||||
if (e.keyCode == 65) {
|
||||
keys.left = true;
|
||||
}
|
||||
|
||||
if (e.keyCode == 80) {
|
||||
if (e.keyCode == 68) {
|
||||
keys.right = true;
|
||||
}
|
||||
|
||||
@ -57,17 +57,17 @@ function keyDownPressed(e) {
|
||||
|
||||
|
||||
function keyUpPressed(e) {
|
||||
if (e.keyCode == 81) {
|
||||
if (e.keyCode == 87) {
|
||||
keys.up = false;
|
||||
} else if (e.keyCode == 65) {
|
||||
} else if (e.keyCode == 83) {
|
||||
keys.down = false;
|
||||
}
|
||||
|
||||
if (e.keyCode == 79) {
|
||||
if (e.keyCode == 65) {
|
||||
keys.left = false;
|
||||
}
|
||||
|
||||
if (e.keyCode == 80) {
|
||||
if (e.keyCode == 68) {
|
||||
keys.right = false;
|
||||
}
|
||||
|
||||
@ -101,10 +101,10 @@ class PlayerObject{
|
||||
constructor(x, y){
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = 200;
|
||||
this.width = 150;
|
||||
this.height = 150;
|
||||
this.color = 'blue';
|
||||
this.speed = 10;
|
||||
this.speed = 5;
|
||||
this.lives = 3;
|
||||
this.score = 0;
|
||||
this.health = 100;
|
||||
@ -127,4 +127,4 @@ class PlayerObject{
|
||||
}
|
||||
}
|
||||
|
||||
let player1 = new PlayerObject(100.100);
|
||||
let player1 = new PlayerObject(100,100);
|
||||
Loading…
x
Reference in New Issue
Block a user