Control Update

This commit is contained in:
Bluwww 2025-11-28 19:05:14 +07:00
parent 6e7cf9166c
commit 45769a6906
2 changed files with 13 additions and 13 deletions

View File

@ -34,17 +34,17 @@ function init() {
} }
function keyDownPressed(e) { function keyDownPressed(e) {
if (e.keyCode == 81) { if (e.keyCode == 87) {
keys.up = true; keys.up = true;
} else if (e.keyCode == 65) { } else if (e.keyCode == 83) {
keys.down = true keys.down = true
} }
if (e.keyCode == 79) { if (e.keyCode == 65) {
keys.left = true; keys.left = true;
} }
if (e.keyCode == 80) { if (e.keyCode == 68) {
keys.right = true; keys.right = true;
} }
@ -57,17 +57,17 @@ function keyDownPressed(e) {
function keyUpPressed(e) { function keyUpPressed(e) {
if (e.keyCode == 81) { if (e.keyCode == 87) {
keys.up = false; keys.up = false;
} else if (e.keyCode == 65) { } else if (e.keyCode == 83) {
keys.down = false; keys.down = false;
} }
if (e.keyCode == 79) { if (e.keyCode == 65) {
keys.left = false; keys.left = false;
} }
if (e.keyCode == 80) { if (e.keyCode == 68) {
keys.right = false; keys.right = false;
} }
@ -101,10 +101,10 @@ class PlayerObject{
constructor(x, y){ constructor(x, y){
this.x = x; this.x = x;
this.y = y; this.y = y;
this.width = 200; this.width = 150;
this.height = 150; this.height = 150;
this.color = 'blue'; this.color = 'blue';
this.speed = 10; this.speed = 5;
this.lives = 3; this.lives = 3;
this.score = 0; this.score = 0;
this.health = 100; this.health = 100;
@ -127,4 +127,4 @@ class PlayerObject{
} }
} }
let player1 = new PlayerObject(100.100); let player1 = new PlayerObject(100,100);

View File

@ -21,5 +21,5 @@ body {
width: 1280px; width: 1280px;
height: 650px; height: 650px;
margin: 0px; margin: 0px;
background-color: black; background-color: rgb(0, 0, 0);
} }