Created
November 9, 2017 17:43
-
-
Save lizzybrooks/295dd04b5c25b587a89a7ac1076377d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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