samples/04_physics_and_collisions/05_box_collision_2/app/main.rb
# Determines next x position of player
Determines next x position of player
Determines next x position of player
def next_x
    if state.dx < 0 
      return state.x - (state.tile_size - state.player_width) 
    else
      return state.x + (state.tile_size - state.player_width) 
    end
  end
def next_x if state . dx < 0 return state . x - ( state . tile_size - state . player_width ) else return state . x + ( state . tile_size - state . player_width ) end end
Determines next x position of player
Determines next x position of player
# if the player moves left # subtracts since the change in x is negative (player is moving left) # adds since the change in x is positive (player is moving right)