Adam-Assignment-07-Life

Eye & Fly

Click to build blocks, click again to get rid off blocks. Use the arrow keys to navigate left, right and up.

The block building is adapted from simple platform game engine by Jacob Haip

Screen Shot 2013-12-17 at 12.21.16 pm

Sleepy Eye

Screen Shot 2013-12-17 at 12.22.03 pm

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
 
///noise 
 
float x, y, oldX, oldY;
float xNoise, yNoise;
float xOffSet, yOffSet;
//
 
 
int blinkbottom = -100;
 
int eyewidth = 200;
 
int pupil = 60;
 
void setup () {
  size (800, 800);
  smooth ();
 
  ///noise 
  xNoise = random( width );
  yNoise = random( height );
  xOffSet = 0.01;  //  change this value to alter the line
  yOffSet = 0.01;  //  change this value to alter the line
}
 
void draw () {
  background (255);
  fill (100);
  noStroke ();
 
 
  float d = dist(width/2, 100, x, y);
  float m = map(d, 0, height-200, 200, 68);
 
    float p1 = map(d, 0, height-200, 59, 27);
 
fill(0); 
        ellipse(mouseX, mouseY, 300, 280); 
 
      drawNoisePoint( );
 
fill(255); 
 
 
  // eye balls 
    ellipse (mouseX, mouseY, eyewidth, m);
 
//map
  float eye1x = map (x, 0, 500, 150, 250);
  float eye1y = map (y, 0, height, 150, 250);
 
 
  eye1x = constrain (eye1x, 150, 250);
 
 
 
 
  // iris
  ellipseMode (CENTER);
  fill (94, 56);
  ellipse (mouseX+eye1x-200, mouseY+eye1y-200, 100, 100);
println(eye1x); 
 
 
  //pupils
  fill (0);
  ellipse (mouseX+eye1x -200, mouseY+eye1y-200, p1, p1);
 
beginShape();
vertex(mouseX -100,mouseY-80);
vertex(mouseX+100,mouseY-80);
vertex(mouseX+100,blinkbottom+mouseY+20);
vertex(mouseX+0,blinkbottom+mouseY);
vertex(mouseX-100,blinkbottom+mouseY+20);
endShape();
 
 
  if ((mousePressed == true) && (blinkbottom<68)) {
    blinkbottom+=15;
  }
  else if (blinkbottom>-100)
  {
    blinkbottom-=10;
  } 
 
 
 
 
}
 
 
 
 
void drawNoisePoint( )
{
    x = noise( xNoise )  * width ;
    y = noise( yNoise )  * height;
    ellipse( x, y, 5, 5 );
    xNoise = xNoise + xOffSet;
    yNoise = yNoise + yOffSet; 
}

Comments are closed.