void GameScene::spawn_tube_pair() { auto upper_tube = get_an_inactive_tube(); int upper_tube_pos_y{ std::rand() % 250 + 350 }; // dummy upper_tube->initialize_position((float)upper_tube_pos_y); upper_tube->setAnchorPoint(Vec2{ 1, 0 }); upper_tube->set_score(0); upper_tube->start_moving(); auto lower_tube = get_an_inactive_tube(); float lower_tube_pos_y{ (float)upper_tube_pos_y - TUBE_UPPER_LOWER_GAP }; lower_tube->initialize_position(lower_tube_pos_y); lower_tube->setAnchorPoint(Vec2{ 1, 1 }); lower_tube->setFlippedY(true); lower_tube->set_score(1); lower_tube->start_moving(); }
Driver::Driver(EventQueue& logic_queue, bool use_simulator) : logic_queue(logic_queue), fsm(logic_queue) { std::string driver_string = use_simulator ? "simulated" : "hardware"; elev_init(use_simulator ? ET_Simulation : ET_Comedi); LOG_INFO("Driver started (" << driver_string << ")"); int current_floor = initialize_position(); if (current_floor >= 0) { LOG_INFO("Elevator is now at floor " << current_floor); } else { throw InitException("Failed to position the elevator at a known floor!"); } fsm.set_floor(current_floor); }