// Kleptomaniac santa int KS_STEAL = 0; int KS_TALK = 1; int KS_IDLE = 2; int KS_IDLE_PHASE = -1; int KS_GREET_PHASE = 0; int KS_STEAL_PHASE = 1; int KS_LEAVING_PHASE = 2; class KleptoSanta { int state; float xpos, ypos; boolean flip; Animation steal, talk, idle; int frame; int lastTime = 0; String[] taunts; int gamePhase = KS_IDLE_PHASE; int phaseTime = 0; String textBuf = ""; KleptoSanta(float x, float y, int time, boolean f) { lastTime = time; frame = 0; xpos = x; ypos = y; flip = f; state = KS_IDLE; steal = loadAnimation("santa_grab"); idle = loadAnimation("santa_idle2"); talk = loadAnimation("santa_talk"); taunts = new String[6]; taunts[0] = "TRY A DIFFERENT LETTER"; taunts[1] = "GEE MAYBE YOUR KEYBOARD BROKE"; taunts[2] = "LOOK AT ALL THE KEYS I FOUND"; taunts[3] = "hmm ARE YOU BEING ROBBED"; taunts[4] = "HMM i am a kleptomaniac"; taunts[5] = "MAYBE IF YOU TYPED FASTER"; } void Steal(int time) { frame = 0; lastTime = time; state = KS_STEAL; } void Idle() { state = KS_IDLE; } void Talk() { state = KS_TALK; } int Draw(int time, int s) // returns state { if (state == KS_STEAL) { if (!steal.inited) steal.init(); frame += time - lastTime; if (frame >= steal.totalFrames) { state = KS_TALK; } else { steal.display(xpos,ypos,frame,false,s,flip); } } if (state == KS_IDLE) { idle.display(xpos,ypos,time,true,s,flip); } if (state == KS_TALK) { talk.display(xpos,ypos,time,true,s,flip); } lastTime = time; return state; } }