v0.2.3: added festive rat king =)

This commit is contained in:
Evan Debenham
2014-12-16 22:34:31 -05:00
parent f9dafd5bba
commit 40760bb797
2 changed files with 19 additions and 7 deletions
@@ -74,8 +74,10 @@ public class RatKing extends NPC {
@Override @Override
public String description() { public String description() {
return return ((RatKingSprite)sprite).festive ?
"This rat is a little bigger than a regular marsupial rat " + "This rat is a little bigger than a regular marsupial rat. " +
"It's wearing a tiny festive hat instead of its usual crown. Happy Holidays!"
: "This rat is a little bigger than a regular marsupial rat " +
"and it's wearing a tiny crown on its head."; "and it's wearing a tiny crown on its head.";
} }
} }
@@ -20,26 +20,36 @@ package com.shatteredpixel.shatteredpixeldungeon.sprites;
import com.watabou.noosa.TextureFilm; import com.watabou.noosa.TextureFilm;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import java.util.Calendar;
public class RatKingSprite extends MobSprite { public class RatKingSprite extends MobSprite {
public boolean festive;
public RatKingSprite() { public RatKingSprite() {
super(); super();
final Calendar calendar = Calendar.getInstance();
//once a year the rat king feels a bit festive!
festive = (calendar.get(Calendar.MONTH) == 11 && calendar.get(Calendar.WEEK_OF_MONTH) > 2);
final int c = festive ? 8 : 0;
texture( Assets.RATKING ); texture( Assets.RATKING );
TextureFilm frames = new TextureFilm( texture, 16, 16 ); TextureFilm frames = new TextureFilm( texture, 16, 17 );
idle = new Animation( 2, true ); idle = new Animation( 2, true );
idle.frames( frames, 0, 0, 0, 1 ); idle.frames( frames, c+0, c+0, c+0, c+1 );
run = new Animation( 10, true ); run = new Animation( 10, true );
run.frames( frames, 2, 3, 4, 5, 6 ); run.frames( frames, c+2, c+3, c+4, c+5, c+6 );
attack = new Animation( 15, false ); attack = new Animation( 15, false );
attack.frames( frames, 0 ); attack.frames( frames, c+0 );
die = new Animation( 10, false ); die = new Animation( 10, false );
die.frames( frames, 0 ); die.frames( frames, c+0 );
play( idle ); play( idle );
} }