forked from LindseyB/AsciiAsciiRevolution
-
Notifications
You must be signed in to change notification settings - Fork 1
/
dancingMan.d
34 lines (27 loc) · 1.1 KB
/
dancingMan.d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
module dancingMan;
import animatedAsciiSprite;
import types;
class DancingMan {
AnimatedAsciiSprite[6] _animations;
Animate _curAnimation;
this() {
// init animations
_animations[Animate.DOWN] = new AnimatedAsciiSprite("graphics/man-down.txt", null, true, false, 26, 24);
_animations[Animate.LEFT] = new AnimatedAsciiSprite("graphics/man-left.txt", null, true, false, 26, 24);
_animations[Animate.MOONWALK] = new AnimatedAsciiSprite("graphics/man-moonwalk.txt", null, true, false, 26, 24);
_animations[Animate.RIGHT] = new AnimatedAsciiSprite("graphics/man-right.txt", null, true, false, 26, 24);
_animations[Animate.UP] = new AnimatedAsciiSprite("graphics/man-up.txt", null, true, false, 26, 22);
_animations[Animate.YMCA] = new AnimatedAsciiSprite("graphics/man-ymca.txt", null, true, false, 26, 24);
}
void setCurAnimation(Animate animation) {
_curAnimation = animation;
_animations[_curAnimation]._animate = true;
}
void animate() {
_animations[_curAnimation].drawSprite();
_animations[_curAnimation].nextFrame();
}
void draw() {
_animations[_curAnimation].drawSprite();
}
}