Guest User

Untitled

a guest
Oct 20th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. var pantallax,pantallay;
  2. var movimentoBraso;
  3. var nube;
  4.  
  5. function setup() {
  6. createCanvas(400, 400);
  7. pantallax=width/2;
  8. pantallay=height/2;
  9. nube=new nubes();
  10. }
  11.  
  12. function draw() {
  13. background(220);
  14. Robot();
  15. nube.movimiento();
  16. nube.display();
  17. nube.colision1();
  18. }
  19. function Robot(){
  20. stroke(0);
  21. //Piez
  22. fill(0);
  23. arc(pantallax,pantallay+190,150,14,5,4);
  24. //Cuerpo
  25. fill(100,100,200);
  26. rect(width/2-24,height/2,50,190);
  27. //Cabeza
  28. fill(100,200,10);
  29. ellipse(width/2,height/2,100,100);
  30. //Ojos
  31. fill(255);
  32. ellipse(width/2-18,height/2-15,15,15);
  33. ellipse(width/2 +20,height/2-15,15,15);
  34. //Pupila
  35. fill(0,222,0);
  36. ellipse(pantallax-18,pantallax-15,5,5);
  37. fill(0,222,0);
  38. ellipse(pantallax+20,pantallay-15,5,5);
  39. //Boca
  40. noFill(0);
  41. arc(pantallax,pantallay+15,20,8,0,3);
  42. //Botones
  43. fill(200,0,0);
  44. ellipse(pantallax,pantallay+100,12,12);
  45. fill(0,200,0);
  46. ellipse(pantallax,pantallay+80,12,12);
  47. fill(0,0,250);
  48. ellipse(pantallax,pantallay+120,12,12);
  49. //Brazos
  50. fill(10,10,10);
  51. rect(pantallax+26,pantallay+50,18,10);
  52. fill(10,10,10);
  53. rect(pantallax-43,pantallay+50,18,10);
  54. strokeWeight(2);
  55. fill(150,0,150);
  56. line(168,250,168,350);
  57. fill(150,0,150);
  58. line(238,250,238,350);
  59. }
  60. function nubes(){
  61. this.x =50;
  62. this.y=50;
  63. this.w=50;
  64. this.speed =0.5;
  65. this.direccion =5;
  66. this.movimiento=function(){
  67. this.x+=1;
  68. }
  69. this.display=function(){
  70. stroke(255)
  71. fill(255);
  72. ellipse(this.x,this.y,this.w,this.w);
  73. ellipse(this.x+48,this.y,this.w,this.w);
  74. ellipse(this.x+20,this.y-30,this.w,this.w);
  75. }
  76. this.colision1=function(){
  77. if(this.x>width){
  78. this.x=0;
  79. }
  80. }
  81. }
Add Comment
Please, Sign In to add comment