speed control of player and the ground

This commit is contained in:
Filipriec
2025-11-15 20:55:29 +01:00
parent 0ff2be6564
commit 2753aed573
6 changed files with 69 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
// src/game/state.cpp
#include "state.h"
#include "../render/player.h"
#include "../timing/speed_controller.h"
void WalkingState::update() {
// stop crawling after duration
@@ -18,8 +19,8 @@ void WalkingState::start_crawl() {
}
// TODO THIS NEEDS REDESIGN ACCORDING TO SPEED
void WalkingState::toggle_walk_frame() {
if ((run_index += 3) >= 7) run_index = 0;
void WalkingState::toggle_walk_frame(int step) {
run_index = (run_index + step) % 7;
}
// void RunningState::toggle_run_frame() {
// if (++run_index >= 7) run_index = 0;