speed control of player and the ground
This commit is contained in:
@@ -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};
|
||||||
|
|||||||
@@ -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 0‑6
|
int walk_index = 0; // cycles 0‑6
|
||||||
int run_index = 0; // cycles 0‑6
|
int run_index = 0; // cycles 0‑6
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user