fixed crawling
This commit is contained in:
@@ -13,7 +13,6 @@ struct Obstacle {
|
|||||||
int height;
|
int height;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Axis-aligned bounding-box collision
|
|
||||||
inline bool check_collision(const CharacterPosition& player,
|
inline bool check_collision(const CharacterPosition& player,
|
||||||
MovementType movement,
|
MovementType movement,
|
||||||
const Obstacle& obs) {
|
const Obstacle& obs) {
|
||||||
|
|||||||
@@ -102,10 +102,10 @@ void MovementState::update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MovementState::start_crawl(PlayerState crawl_type) {
|
void MovementState::start_crawl(PlayerState crawl_type) {
|
||||||
if (crawl_type != PlayerState::Crawl1 && crawl_type != PlayerState::Crawl2)
|
if (current_state != PlayerState::Crawl1 && current_state != PlayerState::Crawl2) {
|
||||||
return;
|
|
||||||
|
|
||||||
previous_state = current_state;
|
previous_state = current_state;
|
||||||
|
}
|
||||||
|
|
||||||
current_state = crawl_type;
|
current_state = crawl_type;
|
||||||
state_timer.stop();
|
state_timer.stop();
|
||||||
state_timer.reset();
|
state_timer.reset();
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ void render_loop(int speed) {
|
|||||||
int player_speed = 6;
|
int player_speed = 6;
|
||||||
bool game_over = false;
|
bool game_over = false;
|
||||||
|
|
||||||
player_state.set_state(PlayerState::Run);
|
player_state.set_state(PlayerState::Walk);
|
||||||
|
|
||||||
CrawlObstacleType type = CrawlObstacleType::Crawl1;
|
CrawlObstacleType type = CrawlObstacleType::Crawl1;
|
||||||
int start_x = VIEW_WIDTH + 10;
|
int start_x = VIEW_WIDTH + 10;
|
||||||
|
|||||||
Reference in New Issue
Block a user