player.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. this.initialize = function() {
  2. // this.future(0).updateAvatar();
  3. };
  4. this.createPlayerBody = function() {
  5. let color = this.getRandomColor();
  6. let vis = {
  7. "extends": "proxy/two/group.vwf",
  8. "properties": {},
  9. "children":{
  10. "body":{
  11. "extends": "proxy/two/ellipse.vwf",
  12. "properties": {
  13. "width": 30,
  14. "height": 30,
  15. "fill": color,
  16. "opacity": 0.7,
  17. "linewidth": 4
  18. }
  19. }
  20. }
  21. }
  22. this.children.create("vis", vis, function(child){
  23. this.delta = [0,0]
  24. this.stepping = true;
  25. this.stepTime = 0.2;
  26. this.step();
  27. // if (!nodeDef) {
  28. // }
  29. });
  30. };
  31. this.move = function(x,y){
  32. this.x = x;
  33. this.y = y;
  34. if(this.dragID){
  35. let node = this.getScene().findNodeByID(this.dragID);
  36. node.x = this.x - this.delta[0];
  37. node.y = this.y - this.delta[1]
  38. }
  39. }
  40. this.checkOver = function(x, y){
  41. //console.log("CHECK OVER from ", this.id);
  42. }
  43. this.do = function(){
  44. this.checkOver(this.x, this.y);
  45. }