/**************************************************
** GAME PLAYER CLASS
**************************************************/
var Player = function(startX, startY, color) {
	var x = startX,
		y = startY,
		color = color,
		id,
		moveAmount = 2;

	// Getters and setters
	var getX = function() {
		return x;
	};

	var getY = function() {
		return y;
	};

	var setX = function(newX) {
		x = newX;
	};

	var setY = function(newY) {
		y = newY;
	};

	var getColor = function() {
		return color;
	};

	var setColor = function(newColor) {
		color = newColor;
	};

	// Update player position
	var update = function(keys) {
		// Previous position
		var prevX = x,
			prevY = y;

		// Up key takes priority over down
		if (keys.up) {
			y -= moveAmount;
		} else if (keys.down) {
			y += moveAmount;
		};

		// Left key takes priority over right
		if (keys.left) {
			x -= moveAmount;
		} else if (keys.right) {
			x += moveAmount;
		};

		return (prevX != x || prevY != y) ? true : false;
	};

	var updateMove = function(devOris) {

		var prevX = x,
			prevY = y;

		// Up key takes priority over down
		if (devOris.up) {
			if(y > 3+5){
				y -= 1;
			}
			
		} else if (devOris.down) {
			if(y < canvasHeight-3-5){
				y += 1;
			}
			
		};

		// Left key takes priority over right
		if (devOris.left) {
			if(x > 3+5){
				x -= 1;
			}
			
		} else if (devOris.right) {
			if(x < canvasWidth-3-5){
				x += 1;
			}
			
		};

		return (prevX != x || prevY != y) ? true : false;
	};

	// Draw player
	var draw = function(ctx) {
		ctx.fillStyle = color;
		ctx.fillRect(x-5, y-5, 10, 10);
	};

	// Define which variables and methods can be accessed
	return {
		getX: getX,
		getY: getY,
		getColor: getColor,
		setX: setX,
		setY: setY,
		setColor: setColor,
		update: update,
		updateMove: updateMove,
		draw: draw
	}
};
@@ -236,16 +236,66 @@
 unt = 2;
+%0A%09var canvasWidth = 1024;%0A%09var canvasHeight =%09768;
 %0A%0A%09// Ge
@@ -631,409 +631,8 @@
 ion%0A
-%09var update = function(keys) %7B%0A%09%09// Previous position%0A%09%09var prevX = x,%0A%09%09%09prevY = y;%0A%0A%09%09// Up key takes priority over down%0A%09%09if (keys.up) %7B%0A%09%09%09y -= moveAmount;%0A%09%09%7D else if (keys.down) %7B%0A%09%09%09y += moveAmount;%0A%09%09%7D;%0A%0A%09%09// Left key takes priority over right%0A%09%09if (keys.left) %7B%0A%09%09%09x -= moveAmount;%0A%09%09%7D else if (keys.right) %7B%0A%09%09%09x += moveAmount;%0A%09%09%7D;%0A%0A%09%09return (prevX != x %7C%7C prevY != y) ? true : false;%0A%09%7D;%0A%0A
 %09var
@@ -761,17 +761,21 @@
 %7B%0A%09%09%09if(
-y
+prevY
  %3E 3+5)%7B
@@ -783,33 +783,32 @@
 %09%09%09%09y -= 1;%0A%09%09%09%7D
-%0A
 %09%09%09%0A%09%09%7D else if 
@@ -830,17 +830,21 @@
 %7B%0A%09%09%09if(
-y
+prevY
  %3C canva
@@ -952,17 +952,21 @@
 %7B%0A%09%09%09if(
-x
+prevX
  %3E 3+5)%7B
@@ -1023,17 +1023,21 @@
 %7B%0A%09%09%09if(
-x
+prevX
  %3C canva
@@ -1384,16 +1384,16 @@
 : setY,%0A
+
 %09%09setCol
@@ -1410,26 +1410,8 @@
 or,%0A
-%09%09update: update,%0A
 %09%09up

fix some bug