Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Creating variables
- var socket = io();
- var myX=0 ,myY=0;
- socket.on("number", function(data){
- console.log(data);
- })
- socket.on("natisna", function(key){
- console.log(key);
- })
- function update() {
- /*if(isKeyPressed[68]){
- myX++;
- }
- if(isKeyPressed[65]){
- myX--;
- }
- if(isKeyPressed[83]){
- myY++;
- }
- if(isKeyPressed[87]){
- myY--;
- }*/
- }
- function draw() {
- context.fillRect(myX,myY,30,30)
- }
- function keyup(key) {
- socket.emit("key", String.fromCharCode(key));
- console.log("Pressed", key);
- }
- function mouseup() {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement