public void think() { if (dead && deadTime > 0) { deadTime -= Wuigi.time(); if (deadTime < 0) { vel.x = 0; vel.y = 15; } return; } if (star) { starTime += Wuigi.time(); if (starTime > 10000 / 15) { // if you've been in starman mode for more than 10 seconds, stop star = false; starTime = 0; setSpriteColor(spriteColor, true); } else { setSpriteColor((int) (Math.random() * 6), true); } } if (invulerable) { invulerableTime += Wuigi.time(); if (invulerableTime > 5000 / 15) { invulerable = false; invulerableTime = 0; } } if (cape) { capeTime += Wuigi.time(); if (capeTime > 10000 / 15) { cape = false; capeTime = 0; } } updatePosition(); xOffset += pos.x - posLast.x; if (xOffset > X_OFFSET) xOffset = X_OFFSET; else if (xOffset < -X_OFFSET) xOffset = -X_OFFSET; yOffset += pos.y - posLast.y; if (!(dead || falling)) { if (yOffset > Y_OFFSET) yOffset = Y_OFFSET; else if (yOffset < Y_OFFSET / 8) yOffset = Y_OFFSET / 8; } updateVelocity(); // double v = vel.y; // if(v > 0 && vel.y < 0){ // System.out.println("position: " + pos.y); // } falling = false; }
public void setSpriteColor(int c) { setSpriteColor(c, false); }