diff options
| -rw-r--r-- | src/main.c | 7 | ||||
| -rw-r--r-- | src/wall.c | 13 |
2 files changed, 15 insertions, 5 deletions
@@ -44,9 +44,9 @@ main_loop(void) rodeo_audio_music_stop_fadeOut(1000); } - player_shoot(get_player_bullet_world()); - enemies_attempt_weapon_fire(); - attempt_random_enemy_spawn((rodeo_rectangle_t){ 0, 0, window_width, window_height }); + //player_shoot(get_player_bullet_world()); + //enemies_attempt_weapon_fire(); + //attempt_random_enemy_spawn((rodeo_rectangle_t){ 0, 0, window_width, window_height }); move_bullets(); move_enemies(); @@ -125,6 +125,7 @@ main(void) { wall_init_do() { + spawn_enemy(764.0f+73.0f,500.0f); rodeo_mainLoop_run( main_loop ); @@ -104,12 +104,16 @@ moving_wall_resolver( .height = p->height }; rodeo_rectangle_t intersection = rodeo_collision_2d_get_collision_rect(p, w); + // left collision if (intersection.width < intersection.height) { - if (intersection.x == step.x) { + // colliding left/right + // if x equal push right + if (intersection.x >= step.x) { p->x = w->x + w->width; if (p->dx < 0) { p->dx = 0; } + // else push left } else { p->x = w->x - p->width; if (p->dx > 0) { @@ -118,11 +122,14 @@ moving_wall_resolver( } } else if (intersection.height < intersection.width) { - if (intersection.y == step.y) { + // colliding up/down + // if y equal push down + if (intersection.y >= step.y) { p->y = w->y + w->height; if (p->dy < 0) { p->dy = 0; } + // else push up } else { p->y = w->y - p->height; if (p->dy > 0) { @@ -130,6 +137,8 @@ moving_wall_resolver( } } } + // tunneled into a hitbox + // don't allow movement else if (p->width == w->width && p->height == w->height) { p->dx = 0; p->dy = 0; |
