MCPcopy Create free account
hub / github.com/EasyRPG/Player / UpdateAnimation

Method UpdateAnimation

src/game_character.cpp:176–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174}
175
176void Game_Character::UpdateAnimation() {
177 const auto speed = Utils::Clamp(GetMoveSpeed(), 1, 6);
178
179 if (IsSpinning()) {
180 const auto limit = GetSpinAnimFrames(speed);
181
182 IncAnimCount();
183
184 if (GetAnimCount() >= limit) {
185 SetFacing((GetFacing() + 1) % 4);
186 SetAnimCount(0);
187 }
188 return;
189 }
190
191 if (IsAnimPaused() || IsJumping()) {
192 ResetAnimation();
193 return;
194 }
195
196 if (!IsAnimated()) {
197 return;
198 }
199
200 const auto stationary_limit = GetStationaryAnimFrames(speed);
201 const auto continuous_limit = GetContinuousAnimFrames(speed);
202
203 if (IsContinuous()
204 || GetStopCount() == 0
205 || data()->anim_frame == lcf::rpg::EventPage::Frame_left || data()->anim_frame == lcf::rpg::EventPage::Frame_right
206 || GetAnimCount() < stationary_limit - 1) {
207 IncAnimCount();
208 }
209
210 if (GetAnimCount() >= continuous_limit
211 || (GetStopCount() == 0 && GetAnimCount() >= stationary_limit)) {
212 IncAnimFrame();
213 return;
214 }
215}
216
217void Game_Character::UpdateFlash() {
218 Flash::Update(data()->flash_current_level, data()->flash_time_left);

Callers 1

UpdateMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected