PImage base;
PImage haeppy;
PImage haeppy2;
PImage tonguy;
PImage esleep;
PImage cry0;
PImage cry1;
PImage sad;
PImage angery;
PImage judge;
PImage vjudge;
PImage poker;
PImage right;
PImage left;
PImage megane;
PImage haeppy_tongue;
PImage watafaku_tongue;
PImage toumei;
PImage watafaku;
PImage hearto;

int basex;
int basey;
int basexincrement;
//PImage []

void setup() {

base = loadImage ("base.png");
haeppy = loadImage ("haeppy.png");
haeppy2 = loadImage ("haeppy2.png");
tonguy = loadImage ("tongue.png");
esleep = loadImage ("esleep.png");
cry0 = loadImage ("cry0.png");
cry1 = loadImage ("cry1.png");
sad = loadImage ("sad.png");
angery = loadImage ("angery0.png");

megane = loadImage ("megane.png");
haeppy_tongue = loadImage ("haeppy_tongue.png");
watafaku_tongue = loadImage ("watafaku_tongue.png");
toumei = loadImage ("toumei.png");
watafaku = loadImage ("watafaku.png");

hearto = loadImage("hearto.png");

judge = loadImage ("judge.png");
vjudge = loadImage ("vjudge.png");
poker = loadImage ("poker.png");
right = loadImage ("right.png");
left = loadImage("left.png");

size(256, 128);
noCursor();

basex = 200;
basey = 75;
basexincrement = -1;

base.resize(100, 100);
esleep.resize(150, 150);
poker.resize(150, 150);
vjudge.resize(200, 200);
judge.resize(100, 100);

//load font
f = loadFont("Monospaced-10.vlw");
textFont(f, 12);
fill(255);
}

void draw() {
background(0, 0, 255);
text(text[textIndex], 20, 20);

basex = basex + basexincrement;
delay(100);

showGotchi(base, basex, basey, 0);
showGotchi(poker, 120, 20, 1);
showGotchi(esleep, basex/2, basey/2, 2);
showGotchi(esleep, 100, 20, 3);
showGotchi(judge, 80, 0, 4);
judge.resize(300, 300);
showGotchi(judge, 80, 0, 5);
showGotchi(esleep, 80, 0, 7);
showGotchi(esleep, 80, 0, 8);
showGotchi(esleep, basex/2, basey/3, 9);



//if (basex > 380) {
// basexincrement = 0;
//}



//tamagotcho se mueve

//tamagotcho se para
//tamagotcho se para
if (basex < 170) {
basexincrement = 0;
}

if (basex > 370) {
basexincrement = 0; //pero se queda en 381?
}
}
void showGotchi (PImage image, int x, int y, int textIndexNow) {

if (textIndex == textIndexNow) {
image(image, x, y);
}
}
PFont f;
float text0 = 0;

int numeroDeElementosEnLaLista = 11;
int textIndex = 0;
//texto
String[] text = {
"hello",
"oh",
"...",
"why",
"do u",
"chose",
"mE",
"ugh",
"bye",
"so done",
" ",
};

void keyReleased() {
if (keyCode == 'X') {
textIndex = (textIndex + 1) % numeroDeElementosEnLaLista;
}
}