Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. grid[row][col] = $('<div>')
  2. .css({
  3. top : row * 100 + 'px',
  4. left : col * 100 + 'px'
  5. })
  6. .text(number)
  7. .addClass('box')
  8. .appendTo($('#grid'));
  9.  
  10. function merge(row1, col1, row2, col2) {
  11. grid[row2][col2].remove();
  12. grid[row2][col2] = grid[row1][col1];
  13. grid[row1][col1] = null;
  14. var number = grid[row2][col2].text() * 2 ;
  15.  
  16.  
  17. grid[row2][col2]
  18. .css({
  19. top : row2 * 100 + 'px',
  20. left : col2 * 100 + 'px'
  21. })
  22. .text(number);
  23.  
  24. return true;
  25. }
  26.  
  27. grid[row2][col2].text(number);
  28. grid[row2][col2].animate({
  29. top : row2 * 100 + 'px',
  30. left : col2 * 100 + 'px'
  31. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement