Guest User

Untitled

a guest
Jul 18th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. /**
  2. * Player
  3. * @param string Session ID
  4. * @param int Default X coordinates
  5. * @param int Default Y coordinates
  6. * @param string Default Color
  7. * @constructor
  8. */
  9. function Player(id, default_x, default_y, default_color) {
  10. this.name = null;
  11. this.element = null;
  12. this.id = id;
  13. this.dom = null;
  14. this.default_x = default_x;
  15. this.default_y = default_y;
  16. this.default_color = default_color;;
  17. this.element = '<div class="player" id="'+this.id+'">';
  18. };
  19.  
  20. /**
  21. * initialize
  22. * Loads a player onto the screen
  23. * @return
  24. */
  25. Player.prototype.initialize = function() {
  26. this.dom = $('#'+this.id).css({
  27. 'left': this.default_x,
  28. 'top' : this.default_y,
  29. 'backgroundColor': this.default_color
  30. });
  31. console.log(this.dom.css('backgroundColor'));
  32. };
  33.  
  34. // Sometimes, console.log(this.dom.css('backgroundColor')); is transparent and I don't know why.
Add Comment
Please, Sign In to add comment