Skip to content

Instantly share code, notes, and snippets.

@lizzybrooks
Created November 9, 2017 17:43
Show Gist options
  • Save lizzybrooks/295dd04b5c25b587a89a7ac1076377d3 to your computer and use it in GitHub Desktop.
Save lizzybrooks/295dd04b5c25b587a89a7ac1076377d3 to your computer and use it in GitHub Desktop.
var person = {
x: 100,
y: 100,
drawPerson: function(){
fill(200);
stroke(200);
ellipse(this.x,this.y,50,50);
line(this.x,this.y,this.x,this.y+200);
},
movePerson: function(){
this.x = mouseX;
}
};
function setup() {
createCanvas(400, 400);
}
function draw(){
background(0);
stroke(255);
fill(255,0,0);
ellipse(100,100,50,50);
noFill();
ellipse(200,200,50,50);
person.drawPerson();
}
function mousePressed(){
person.movePerson();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment