speed control of player and the ground

This commit is contained in:
Filipriec
2025-11-15 20:44:05 +01:00
parent 11f5eb7fd1
commit 0ff2be6564
3 changed files with 6 additions and 3 deletions

View File

@@ -19,8 +19,11 @@ void WalkingState::start_crawl() {
// TODO THIS NEEDS REDESIGN ACCORDING TO SPEED // TODO THIS NEEDS REDESIGN ACCORDING TO SPEED
void WalkingState::toggle_walk_frame() { void WalkingState::toggle_walk_frame() {
if (++walk_index >= 7) walk_index = 0; if ((run_index += 3) >= 7) run_index = 0;
} }
// void RunningState::toggle_run_frame() {
// if (++run_index >= 7) run_index = 0;
// }
FrameSelection WalkingState::get_frame_selection() const { FrameSelection WalkingState::get_frame_selection() const {
FrameSelection f{MovementType::Walk, 0}; FrameSelection f{MovementType::Walk, 0};

View File

@@ -14,7 +14,7 @@ struct FrameSelection {
class WalkingState { class WalkingState {
private: private:
PlayerState current_state = PlayerState::Walk; PlayerState current_state = PlayerState::Run;
Timer state_timer; Timer state_timer;
int walk_index = 0; // cycles 06 int walk_index = 0; // cycles 06
int run_index = 0; // cycles 06 int run_index = 0; // cycles 06

View File

@@ -22,5 +22,5 @@ int main(void) {
printf("Baud: %d, Format: 8-N-1\r\n", BAUD_RATE); printf("Baud: %d, Format: 8-N-1\r\n", BAUD_RATE);
// Just call into render feature // Just call into render feature
render_loop(1); render_loop(6);
} }