diff options
-rw-r--r-- | res/sprites/boney_anim.txt | 16 | ||||
-rw-r--r-- | res/sprites/duster_anim.txt | 10 | ||||
-rw-r--r-- | res/sprites/kuma_anim.txt | 16 | ||||
-rw-r--r-- | res/sprites/lucas_anim.txt | 10 | ||||
-rw-r--r-- | src/animation_system.cpp | 12 |
5 files changed, 36 insertions, 28 deletions
diff --git a/res/sprites/boney_anim.txt b/res/sprites/boney_anim.txt index 65901b9..039db95 100644 --- a/res/sprites/boney_anim.txt +++ b/res/sprites/boney_anim.txt | |||
@@ -1,13 +1,13 @@ | |||
1 | ../res/sprites/boney.png | 1 | ../res/sprites/boney.png |
2 | ../res/sprites/boney_frames.txt | 2 | ../res/sprites/boney_frames.txt |
3 | still[down]: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,104,96,104 | 3 | still[down]: 0#64,96,104,96,104 |
4 | still[down_left]: 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,97,105,97,105 | 4 | still[down_left]: 1#64,97,105,97,105 |
5 | still[left]: 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,98,106,98,106 | 5 | still[left]: 2#64,98,106,98,106 |
6 | still[up_left]: 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,99,107,99,107 | 6 | still[up_left]: 3#64,99,107,99,107 |
7 | still[up]: 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,100,108,100,108 | 7 | still[up]: 4#64,100,108,100,108 |
8 | still[up_right]: 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,101,109,101,109 | 8 | still[up_right]: 5#64,101,109,101,109 |
9 | still[right]: 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,102,110,102,110 | 9 | still[right]: 6#64,102,110,102,110 |
10 | still[down_right]: 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,103,111,103,111 | 10 | still[down_right]: 7#64,103,111,103,111 |
11 | frozen[down]: 0 | 11 | frozen[down]: 0 |
12 | frozen[down_left]: 1 | 12 | frozen[down_left]: 1 |
13 | frozen[left]: 2 | 13 | frozen[left]: 2 |
diff --git a/res/sprites/duster_anim.txt b/res/sprites/duster_anim.txt index 9c1ed3f..6853ed8 100644 --- a/res/sprites/duster_anim.txt +++ b/res/sprites/duster_anim.txt | |||
@@ -1,13 +1,13 @@ | |||
1 | ../res/sprites/duster.png | 1 | ../res/sprites/duster.png |
2 | ../res/sprites/duster_frames.txt | 2 | ../res/sprites/duster_frames.txt |
3 | still[down]: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,212,0,212 | 3 | still[down]: 0#57,212,0,212 |
4 | still[down_left]: 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,213,1,213 | 4 | still[down_left]: 1#57,213,1,213 |
5 | still[left]: 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,214,2,214 | 5 | still[left]: 2#57,214,2,214 |
6 | still[up_left]: 3 | 6 | still[up_left]: 3 |
7 | still[up]: 4 | 7 | still[up]: 4 |
8 | still[up_right]: 5 | 8 | still[up_right]: 5 |
9 | still[right]: 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,215,6,215 | 9 | still[right]: 6#57,215,6,215 |
10 | still[down_right]: 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,216,7,216 | 10 | still[down_right]: 7#57,216,7,216 |
11 | frozen[down]: 0 | 11 | frozen[down]: 0 |
12 | frozen[down_left]: 1 | 12 | frozen[down_left]: 1 |
13 | frozen[left]: 2 | 13 | frozen[left]: 2 |
diff --git a/res/sprites/kuma_anim.txt b/res/sprites/kuma_anim.txt index bd56fe6..b60675f 100644 --- a/res/sprites/kuma_anim.txt +++ b/res/sprites/kuma_anim.txt | |||
@@ -1,13 +1,13 @@ | |||
1 | ../res/sprites/kumatora.png | 1 | ../res/sprites/kumatora.png |
2 | ../res/sprites/kumatora_frames.txt | 2 | ../res/sprites/kumatora_frames.txt |
3 | still[down]: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,136,144,152,144,152,144,152,144,136 | 3 | still[down]: 0#80,128,136,144,152,144,152,144,152,144,136 |
4 | still[down_left]: 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,129,137,145,153,145,153,145,153,145,137 | 4 | still[down_left]: 1#80,129,137,145,153,145,153,145,153,145,137 |
5 | still[left]: 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,130,138,146,154,146,154,146,154,146,138 | 5 | still[left]: 2#80,130,138,146,154,146,154,146,154,146,138 |
6 | still[up_left]: 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,131,139,147,155,147,155,147,155,147,139 | 6 | still[up_left]: 3#80,131,139,147,155,147,155,147,155,147,139 |
7 | still[up]: 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,132,140,148,156,148,156,148,156,148,140 | 7 | still[up]: 4#80,132,140,148,156,148,156,148,156,148,140 |
8 | still[up_right]: 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,133,141,149,157,149,157,149,157,149,141 | 8 | still[up_right]: 5#80,133,141,149,157,149,157,149,157,149,141 |
9 | still[right]: 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,134,142,150,158,150,158,150,158,150,142 | 9 | still[right]: 6#80,134,142,150,158,150,158,150,158,150,142 |
10 | still[down_right]: 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,135,143,151,159,151,159,151,159,151,143 | 10 | still[down_right]: 7#80,135,143,151,159,151,159,151,159,151,143 |
11 | frozen[down]: 0 | 11 | frozen[down]: 0 |
12 | frozen[down_left]: 1 | 12 | frozen[down_left]: 1 |
13 | frozen[left]: 2 | 13 | frozen[left]: 2 |
diff --git a/res/sprites/lucas_anim.txt b/res/sprites/lucas_anim.txt index 3c2906c..0579e94 100644 --- a/res/sprites/lucas_anim.txt +++ b/res/sprites/lucas_anim.txt | |||
@@ -1,13 +1,13 @@ | |||
1 | ../res/sprites/lucas.png | 1 | ../res/sprites/lucas.png |
2 | ../res/sprites/lucas_frames.txt | 2 | ../res/sprites/lucas_frames.txt |
3 | still[down]: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,189,0,189 | 3 | still[down]: 0#53,189,0,189 |
4 | still[down_left]: 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,190,1,190 | 4 | still[down_left]: 1#53,190,1,190 |
5 | still[left]: 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,191,2,191 | 5 | still[left]: 2#53,191,2,191 |
6 | still[up_left]: 3 | 6 | still[up_left]: 3 |
7 | still[up]: 4 | 7 | still[up]: 4 |
8 | still[up_right]: 5 | 8 | still[up_right]: 5 |
9 | still[right]: 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,193,6,193 | 9 | still[right]: 6#53,193,6,193 |
10 | still[down_right]: 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,192,7,192 | 10 | still[down_right]: 7#53,192,7,192 |
11 | frozen[down]: 0 | 11 | frozen[down]: 0 |
12 | frozen[down_left]: 1 | 12 | frozen[down_left]: 1 |
13 | frozen[left]: 2 | 13 | frozen[left]: 2 |
diff --git a/src/animation_system.cpp b/src/animation_system.cpp index 2c2c6a5..b57816b 100644 --- a/src/animation_system.cpp +++ b/src/animation_system.cpp | |||
@@ -65,7 +65,7 @@ void AnimationSystem::initSprite(int spriteId, std::string_view filename) { | |||
65 | std::string animLine; | 65 | std::string animLine; |
66 | std::getline(datafile, animLine); // blank | 66 | std::getline(datafile, animLine); // blank |
67 | while (std::getline(datafile, animLine)) { | 67 | while (std::getline(datafile, animLine)) { |
68 | std::regex re(R"(([a-z!._]+)\[([a-z_]+)\]: ([0-9,]+))"); | 68 | std::regex re(R"(([a-z!._]+)\[([a-z_]+)\]: ([0-9,#]+))"); |
69 | std::smatch m; | 69 | std::smatch m; |
70 | std::regex_match(animLine, m, re); | 70 | std::regex_match(animLine, m, re); |
71 | 71 | ||
@@ -73,7 +73,15 @@ void AnimationSystem::initSprite(int spriteId, std::string_view filename) { | |||
73 | Animation anim; | 73 | Animation anim; |
74 | auto framestrs = splitStr<std::list<std::string>>(m[3], ","); | 74 | auto framestrs = splitStr<std::list<std::string>>(m[3], ","); |
75 | for (const std::string& f : framestrs) { | 75 | for (const std::string& f : framestrs) { |
76 | anim.frameIndices.push_back(std::stoi(f)); | 76 | int times = 1; |
77 | size_t repeat_it = f.find("#"); | ||
78 | if (repeat_it != std::string::npos) { | ||
79 | times = std::stoi(f.substr(repeat_it + 1)); | ||
80 | } | ||
81 | |||
82 | for (int i=0; i<times; i++) { | ||
83 | anim.frameIndices.push_back(std::stoi(f)); | ||
84 | } | ||
77 | } | 85 | } |
78 | 86 | ||
79 | if (animName.back() == '!') { | 87 | if (animName.back() == '!') { |