Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Player::updateInput()
- {
- this->speed = engine.getSpeed();
- if (sf::Keyboard::isKeyPressed(sf::Keyboard::A)) {
- this->engine.brake();
- }
- else if (sf::Keyboard::isKeyPressed(sf::Keyboard::D)) {
- this->engine.gas();
- }
- else {
- this->engine.Idle();
- }
- if (Keyboard::isKeyPressed(Keyboard::W) && canMoveUp())
- {
- this->engine.moveUp();
- }
- if (Keyboard::isKeyPressed(Keyboard::S) && canMoveDown())
- {
- //действия, когда нажали
- this->engine.moveDown();
- }
- if (Keyboard::isKeyPressed(Keyboard::LShift))
- {
- this->engine.nitro();
- isNitring = true;
- if (engine.canNitro())
- {
- if (nitro_s.getStatus() == SoundSource::Status::Stopped)
- nitro_s.play();
- isNitring = true;
- }
- }
- else {
- nitro_s.stop();
- isNitring = false;
- }
- if (sf::Keyboard::isKeyPressed(sf::Keyboard::Q)) {
- this->engine.gearDown();
- }
- else if (sf::Keyboard::isKeyPressed(sf::Keyboard::E)) {
- this->engine.gearUp();
- }
- this->left_wh.rotate(this->speed * 0.6f);
- this->right_wh.rotate(this->speed * 0.6f);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement