Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var armSize = 50;
- var posX = 0;
- var posY = 0;
- var current = 0;
- function drawArm()
- {
- var send = [];
- if(current == 0)
- { // upper left
- send.push({x: posX + 0, y: posY + 0});
- send.push({x: posX + 0, y: posY + armSize});
- send.push({x: posX + armSize, y: posY + armSize});
- }
- if(current == 1)
- { // upper right
- send.push({x: posX + armSize * 2, y: posY + 0});
- send.push({x: posX + armSize, y: posY + 0});
- send.push({x: posX + armSize, y: posY + armSize});
- }
- if(current == 2)
- { // lower right
- send.push({x: posX + armSize * 2, y: posY + armSize * 2});
- send.push({x: posX + armSize * 2, y: posY + armSize});
- send.push({x: posX + armSize, y: posY + armSize});
- }
- if(current == 3)
- { // lower left
- send.push({x: posX + 0, y: posY + armSize * 2});
- send.push({x: posX + armSize, y: posY + armSize * 2});
- send.push({x: posX + armSize, y: posY + armSize});
- }
- if(current == 4)
- {
- // randomize posX, posY, set timeout and return
- posX = Math.floor(Math.random() * 1200);
- posY = Math.floor(Math.random() * 700);
- current = 0;
- setTimeout(drawArm, 100);
- return;
- }
- socket.emit('update', { points: send, color: color, id: 1 });
- current++;
- drawArm();
- }
- drawArm();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement