Vector cast;
float az = 0, el =0;
 
float jx=0,jy=0;
PImage a,b;
 
 
float cx = 0,cy = 100, cz = 45;
float lx = 0.0, ly = -1, ez = 45;
void setup()
{
 
size( 550, 300, P3D);
hint(g.ENABLE_ACCURATE_TEXTURES) ;
a = loadImage("poenderous.png");
b = loadImage("screamPon.png");
 
cast = new Vector();
 
Guy scream = new Guy();
scream.x =0;scream.y =0;
scream.tex = b;
cast.add(scream);
for (int i=0; i < 20; i++){
cast.add(new Guy());
}
 
ellipseMode(CENTER);
 
}
void draw(){
background( 255);
hint(ENABLE_DEPTH_SORT);
 
 
 
camera( cx, -ez , cy, cx + lx, -cz , cy + ly, 0, 1, 0);
fill(200);
 
noStroke();
 
 
 
Guy curr;
for (int i=0; i < cast.size(); i++){
curr = (Guy)cast.elementAt(i);
curr.draw();
}
 
if(keyPressed) {
float speed = 5;
if(key == 'w') {
cx += speed*lx;
cy += speed*ly;
 
}
if(key == 's') {
cx -= speed*lx;
cy -= speed*ly;
 
}
if(key == 'd') {
cx -= speed*ly;
cy += speed*lx;
 
}
if(key == 'a') {
cx += speed*ly;
cy -= speed*lx;
 
}
if(key == 'q') {
float tr = -.1;
lx = lx*cos(tr) - ly*sin(tr);
ly = lx*sin(tr) + ly*cos(tr);
float norm = sqrt(lx*lx + ly*ly);
lx/=norm;
ly/=norm;
}
if(key == 'e') {
float tr = .1;
lx = lx*cos(tr) - ly*sin(tr);
ly = lx*sin(tr) + ly*cos(tr);
float norm = sqrt(lx*lx + ly*ly);
lx/=norm;
ly/=norm;
}
}
 
}
 
void mouseDragged(){
 
cz -= (mouseY-pmouseY)/75.0;
 
float tr = (mouseX-pmouseX)/100.0;
lx = lx*cos(tr) - ly*sin(tr);
ly = lx*sin(tr) + ly*cos(tr);
float norm = sqrt(lx*lx + ly*ly);
lx/=norm;
ly/=norm;
}
class Guy{
 
float accum = 0;
 
PImage tex;
float x,y;
public Guy(){
 
x = random(-300,300);
y = random(-300,100);
//accum = random(0,2*PI);
tex = a;
}
 
void draw(){
 
pushMatrix();
fill(0,5);
rotateX(PI/2);
 
ellipse(-10+x,y,10,10);
ellipse(-10+x,y,20,20);
ellipse(-10+x,y,30,30);
rotateX(-PI/2);
translate( -20 + x,-50,y);
rotateY(accum);
fill(0,255);
 
 
 
beginShape();
texture(tex);
vertex(0, 0, 0, 0);
vertex(20, 0, 393, 0);
vertex(20, 50, 393, 726);
vertex(0, 50, 0, 726);
endShape();
 
popMatrix();
 
}
 
}