Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var pantallax,pantallay;
- var movimentoBraso;
- var nube;
- function setup() {
- createCanvas(400, 400);
- pantallax=width/2;
- pantallay=height/2;
- nube=new nubes();
- }
- function draw() {
- background(220);
- Robot();
- nube.movimiento();
- nube.display();
- nube.colision1();
- }
- function Robot(){
- stroke(0);
- //Piez
- fill(0);
- arc(pantallax,pantallay+190,150,14,5,4);
- //Cuerpo
- fill(100,100,200);
- rect(width/2-24,height/2,50,190);
- //Cabeza
- fill(100,200,10);
- ellipse(width/2,height/2,100,100);
- //Ojos
- fill(255);
- ellipse(width/2-18,height/2-15,15,15);
- ellipse(width/2 +20,height/2-15,15,15);
- //Pupila
- fill(0,222,0);
- ellipse(pantallax-18,pantallax-15,5,5);
- fill(0,222,0);
- ellipse(pantallax+20,pantallay-15,5,5);
- //Boca
- noFill(0);
- arc(pantallax,pantallay+15,20,8,0,3);
- //Botones
- fill(200,0,0);
- ellipse(pantallax,pantallay+100,12,12);
- fill(0,200,0);
- ellipse(pantallax,pantallay+80,12,12);
- fill(0,0,250);
- ellipse(pantallax,pantallay+120,12,12);
- //Brazos
- fill(10,10,10);
- rect(pantallax+26,pantallay+50,18,10);
- fill(10,10,10);
- rect(pantallax-43,pantallay+50,18,10);
- strokeWeight(2);
- fill(150,0,150);
- line(168,250,168,350);
- fill(150,0,150);
- line(238,250,238,350);
- }
- function nubes(){
- this.x =50;
- this.y=50;
- this.w=50;
- this.speed =0.5;
- this.direccion =5;
- this.movimiento=function(){
- this.x+=1;
- }
- this.display=function(){
- stroke(255)
- fill(255);
- ellipse(this.x,this.y,this.w,this.w);
- ellipse(this.x+48,this.y,this.w,this.w);
- ellipse(this.x+20,this.y-30,this.w,this.w);
- }
- this.colision1=function(){
- if(this.x>width){
- this.x=0;
- }
- }
- }
Add Comment
Please, Sign In to add comment