class GuemboiV{ Slideclip cosmos = new Slideclip("guemboi/cosmos.png", 0, -960); Slideclip cordillera = new Slideclip("guemboi/cordillera.png", 0, -200*.64); Slideclip edificiosatras = new Slideclip("guemboi/edificiosatras.png", 0, -100*.64); Slideclip edificios = new Slideclip("guemboi/edificios.png", 0, -75*.64); Slideclip arbolesatras = new Slideclip("guemboi/arbolesatras.png", 0, -100*.64); Slideclip postes = new Slideclip("guemboi/postes.png", 0, 10*.64); Slideclip panderetas = new Slideclip("guemboi/panderetas.png", 0, 60*.64); Slideclip arbolesfrente = new Slideclip("guemboi/arbolesfrente.png", 0, -150*.64); Slideclip primerplano = new Slideclip("guemboi/primerplano.png", 0, -67*.64); Slideclip rejas = new Slideclip("guemboi/rejas.png", 0, -62*.64); Slideclip groundx = new Slideclip("guemboi/groundx.png", 0, 76*.64); Slideclip[] planes_array = { cosmos, cordillera, edificiosatras, edificios, arbolesatras, postes, panderetas, arbolesfrente, primerplano, rejas, groundx }; float[] planes_faktor = { 1, .9, .6, .55, .36, .25, .18, .14, 0, -.5, -.5 }; float[] planes_skroll = { 0, 1024, 1024, 1024, 1024, 1024, 1024, 832, 722, 960, 1024 }; float[] planes_xx = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; Slideclip pivote; float cam_xoff, cam_yoff, dcam_xoff, dcam_yoff, cam_friction; float xx, speed, dspeed, tospeed, maxspeed, speedfriction; float direction, olddirection; Pacos pacos; Encapuxaos encapuxaos; Molotovs molotovs; GuemboiV(){ cam_xoff = 0; cam_yoff = 0; dcam_xoff = 0; dcam_yoff = 0; cam_friction = .2; xx = 0; speed = 0; dspeed = 0; tospeed = 10; maxspeed = 20; speedfriction = .12; pacos = new Pacos(200,5); encapuxaos = new Encapuxaos(-200,5); molotovs = new Molotovs(); } void draw(){ //frameRate(30); switch(frameCount%4){ case 0: case 4: background(255,0,0); break; case 1: background(0); break; case 2: background(255); break; } dcam_xoff = (0-cam_xoff)*cam_friction; dcam_yoff = (0-cam_yoff)*cam_friction; cam_xoff += dcam_xoff; cam_yoff += dcam_yoff; //direction = -1;//int(-joypadA.xslider.getValue()); direction = -(pacos.x+encapuxaos.x)/200; dspeed = (tospeed*direction-speed)*speedfriction; speed += dspeed; //player.direction = -direction; olddirection = direction; float zzka = 1+random(10); for(int i=0;i0)planes_xx[i]-=planes_skroll[i]; //planes_mcxx[i]._x = planes_xx[i]; planes_array[i].xtra_x = planes_xx[i]; if(i==8){ pacos.draw(); encapuxaos.draw(); molotovs.draw(); }; if(i==0){ planes_array[i].draw(); }else if(random(10)>8){ planes_array[i].draw(); if(i==10){ fill(0); rect(0,600,1600,300); } } } cosmos.rotation-=radians(20); /* if(joypadA.bSelect.returned){ skreen=1; undobgm(); game = new Game(); } if(joypadA.bStart.returned){ skreen=0; undobgm(); game = new Game(); }*/ } class Slideclip{ float x = 0; float xtra_x = 0; float y = 0; PImage img; String name; float xoff, yoff; float rotation = 0; Slideclip(String $1, float $2, float $3){ img = loadImage($1); xoff = $2; yoff = $3; } void draw(){ pushMatrix(); translate(400,300); rotateZ(rotation); translate(xoff, yoff); translate(-img.width*.5, -img.height*.5); translate(x+xtra_x, y); translate(0, img.height); image(img,0,0); image(img,img.width,0); popMatrix(); } } class Encapuxaos{ ArrayList grupo; float xbase; float x, tox, dx, friction; int cuantos; int current; boolean attackFlag; Encapuxaos(float xbase, int cuantos){ this.xbase = xbase; x = 0; tox = x; dx = 0; friction = .6;//.16; this.cuantos = cuantos; grupo = new ArrayList(); for(int i=0; i95){ attack(); } } void attack(){ Encapuxao tmp = (Encapuxao)grupo.get(current); tmp.attack(); attackFlag = true; } class Encapuxao{ PImage[] skin; float x, tox, dx, friction; boolean isDead; int direction = 1; int olddirection = 1; int pdirection = 1; boolean isCurrent = false; boolean isAttacking = false; int attackframe; Encapuxao(float x){ this.x = x; tox = x; dx = 0; friction = .96; skin = new PImage[3]; skin[0] = loadImage("guemboi/encapuchao_nada.png"); skin[1] = loadImage("guemboi/encapuchao.png"); skin[2] = loadImage("guemboi/encapuchao_throw.png"); } void draw(){ update(); pushMatrix(); translate(x,0); scale(.4); if((olddirection==-1 && direction==0)||direction==-1){ pdirection=-1; } else if((olddirection==1 && direction==0)||direction==1){ pdirection=1; } if(pdirection==-1)rotateY(-PI); if(isCurrent){ noTint(); noStroke(); fill(255); triangle(0,-170,-20,-200,20,-200); pushMatrix(); if(pdirection==-1)rotateY(-PI); text("P1", -32, -200); popMatrix(); } else{ if(frameCount%3==0){ tint(255, 0 , 0); } else if(frameCount%3==1){ tint(255); } else{ tint(0); } } PImage cskin; if(isCurrent){ if(attackframe>20){ cskin = skin[1]; } else if(attackframe>10){ cskin = skin[2]; } else{ cskin = skin[0]; } } else{ cskin = skin[0]; } translate(-cskin.width*.5,-cskin.height); image(cskin,0,0); popMatrix(); olddirection = direction; noTint(); } void update(){ if(!isAttacking){ if((dx>=0 && x>=tox) || (dx<=0 && x<=tox)){ tox = random(-100,100); if(tox>x){ dx=4; direction = 1; } else if(tox6)x += dx; attackframe--; if(attackframe<=0)endAttack(); } } void attack(){ isAttacking = true; direction = 1; dx = 8; attackframe = 40; } void endAttack(){ isCurrent = false; isAttacking = false; direction = -1; tox = -100; attackframe = 0; attackFlag = false; } } } class Pacos{ ArrayList grupo; float xbase; float x, tox, dx, friction; int cuantos; int current; boolean attackFlag; Pacos(float xbase, int cuantos){ this.xbase = xbase; x = 0; tox = x; dx = 0; friction = .6; this.cuantos = cuantos; grupo = new ArrayList(); for(int i=0; i=grupo.size())current=grupo.size()-1; Paco upper = (Paco)grupo.get(current); upper.draw(); popMatrix(); } void setCurrent(){ int ncurrent = current; while(ncurrent ==current ){ ncurrent = (int)random(grupo.size()); } current = ncurrent; Paco tmp = (Paco)grupo.get(current); if(!tmp.isDead) tmp.isCurrent = true; else setCurrent(); } void update(){ dx = tox - x; if(abs(dx)<1)tox = random(-50,200); x += dx*friction; if(!attackFlag && random(100)>95){ attack(); } } void attack(){ Paco tmp = (Paco)grupo.get(current); tmp.attack(); attackFlag = true; } class Paco{ PImage[] skin; float x, tox, dx, friction; float y, toy, dy; boolean isDead; int direction = 1; int olddirection = 1; int pdirection = 1; boolean isCurrent = false; boolean isAttacking = false; int attackframe; boolean isGoneToHeaven; int life = 10; Paco(float x){ this.x = x; tox = x; dx = 0; friction = .96; skin = new PImage[3]; skin[0] = loadImage("guemboi/ffee.png"); skin[1] = loadImage("guemboi/ffee_2.png"); skin[2] = loadImage("guemboi/ffee.png"); } void draw(){ update(); pushMatrix(); translate(x,0); scale(.4); if((olddirection==-1 && direction==0)||direction==-1){ pdirection=-1; } else if((olddirection==1 && direction==0)||direction==1){ pdirection=1; } if(pdirection==-1)rotateY(-PI); if(isCurrent){ noTint(); noStroke(); fill(255); triangle(0,-170,-20,-200,20,-200); pushMatrix(); if(pdirection==-1)rotateY(-PI); text("P2", -32, -200); popMatrix(); } else{ if(frameCount%3==0){ tint(255, 0 , 0); } else if(frameCount%3==1){ tint(255); } else{ tint(0); } } PImage cskin; if(isCurrent){ if(attackframe>2){ if(frameCount%10<=5){ cskin = skin[1]; } else{ cskin = skin[0]; } } else{ cskin = skin[0]; } } else{ cskin = skin[0]; } translate(-cskin.width*.5,-cskin.height); image(cskin,0,0); popMatrix(); olddirection = direction; noTint(); } void update(){ if(!isAttacking){ if((dx>=0 && x>=tox) || (dx<=0 && x<=tox)){ tox = random(-100,100); if(tox>x){ dx=4; direction = 1; } else if(tox6)x += dx; attackframe--; if(attackframe<=0)endAttack(); } } void attack(){ isAttacking = true; direction = -1; dx = -8; attackframe = 60; } void endAttack(){ isCurrent = false; isAttacking = false; direction = 1; tox = 100; attackframe = 0; attackFlag = false; } void goneToHeaven(){ isGoneToHeaven = true; isCurrent = false; isAttacking = false; } void damage(){ life--; if(life<=0){ isDead = true; isCurrent = false; isAttacking = false; } } } } class Molotovs{ ArrayList mismolotovs; Molotovs(){ mismolotovs = new ArrayList(); } void draw(){ for(int i=0; i=cx-40 && x<=cx+40){ xplode(); //tmp.damage(); break; } } } void xplode(){ isXplode = true; xplodelife = 200; } } } }