Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function setup() {
- createCanvas(600,400);
- ellipseMode(CENTER);
- rectMode(CENTER);
- background(140);
- }
- function keyPressed(){
- if (keyCode === LEFT_ARROW) {
- background(140);
- line(100, 0, 100, 400);
- line(0, 100, 600, 100);
- line(200, 0, 200, 400);
- line(0, 200, 600, 200);
- line(300, 0, 300, 400);
- line(0, 300, 600, 300);
- line(400, 0, 400, 400);
- line(500, 0, 500, 400);
- line(600, 0, 600, 400);
- } else if (keyCode === RIGHT_ARROW) {
- background(140);
- }
- }
- function mousePressed(){
- print("Xpos is "+mouseX);
- print("Ypos is "+mouseY);
- }
- function draw() {
- //alien face
- fill(63,175,85);
- ellipse(200,95,150,150);
- //body
- rect(200,190,100,200);
- triangle(100,200,200,150,300,200);
- //ears
- ellipse()
- //hat
- fill(20,65,120);
- triangle(100,60,200,10,300,60);
- //eye
- fill(255,255,255);
- ellipse(200,95,60,60);
- fill(0,0,0);
- ellipse(200,95,20,20);
- //mouth fangs
- fill(255,255,255);
- ellipse();
- triangle(170,140,180,150,190,140);
- triangle(190,140,200,150,210,140);
- triangle(210,140,220,150,230,140);
- }
Add Comment
Please, Sign In to add comment