Strzelanie Lewym i Prawym przyciskiem myszy.
Dodanie tekstury strzału alternatywnego
This commit is contained in:
18
main.cpp
18
main.cpp
@@ -36,27 +36,31 @@ int main()
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Space)) {
|
||||
ship.shoot();
|
||||
}
|
||||
if(event.type == sf::Event::MouseButtonPressed) {
|
||||
ship.shoot();
|
||||
}
|
||||
}
|
||||
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Left)) {
|
||||
if(event.type == sf::Event::MouseButtonPressed) {
|
||||
if(event.mouseButton.button == sf::Mouse::Left)
|
||||
ship.shoot();
|
||||
else
|
||||
ship.alternate_shoot();
|
||||
}
|
||||
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::A)) {
|
||||
if(ship.getPosition().x > -10) {
|
||||
ship.moveLeft();
|
||||
}
|
||||
}
|
||||
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right)) {
|
||||
if (sf::Keyboard::isKeyPressed(sf::Keyboard::D)) {
|
||||
if(ship.getPosition().x < 480) {
|
||||
ship.moveRight();
|
||||
}
|
||||
}
|
||||
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up)) {
|
||||
if (sf::Keyboard::isKeyPressed(sf::Keyboard::W)) {
|
||||
if(ship.getPosition().y > 0) {
|
||||
ship.moveUp();
|
||||
}
|
||||
}
|
||||
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down)) {
|
||||
if (sf::Keyboard::isKeyPressed(sf::Keyboard::S)) {
|
||||
if(ship.getPosition().y < 700) {
|
||||
ship.moveDown();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user