Skip to content

Commit

Permalink
feat(tutorial): flappy bird mouse instead of keyboard
Browse files Browse the repository at this point in the history
  • Loading branch information
naezith authored and Milerius committed Nov 3, 2019
1 parent 39a6b57 commit 92e11b9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tutorials/flappy-bird/step_7/flappy-bird.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace {

struct flappy_bird_constants {
// Controls
const input::key jump_button{input::space};
const input::mouse_button jump_button{input::mouse_button::left};
// Player
const float gravity{2000.f};
const float jump_force{500.f};
Expand Down Expand Up @@ -327,7 +327,7 @@ class player_logic final : public ecs::logic_update_system<player_logic> {
movement_speed.set_y(movement_speed.y() + constants.gravity * timer::time_step::get_fixed_delta_time());

// Check if jump key is tapped
bool jump_key_pressed = input::is_key_pressed(constants.jump_button);
bool jump_key_pressed = input::is_mouse_button_pressed(constants.jump_button);
bool jump_key_tapped = jump_key_pressed && !jump_key_pressed_last_tick;
jump_key_pressed_last_tick = jump_key_pressed;

Expand Down Expand Up @@ -425,7 +425,7 @@ class game_scene final : public scenes::base_scene {
const auto constants = entity_registry_.ctx<flappy_bird_constants>();

// Check if jump key is tapped
bool jump_key_pressed = input::is_key_pressed(constants.jump_button);
bool jump_key_pressed = input::is_mouse_button_pressed(constants.jump_button);
bool jump_key_tapped = jump_key_pressed && !jump_key_pressed_last_tick;
jump_key_pressed_last_tick = jump_key_pressed;

Expand Down

0 comments on commit 92e11b9

Please sign in to comment.