Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ( Joystick::isButtonPressed(0,0) )
- {
- P2.move(0.0, -5 * speed);
- P2.setTexture(TP2u);
- std::cout << " 0 " << std::endl;
- for (int i = 0; i < n; i++)
- {
- if (P2.getGlobalBounds().intersects(obs[i].getGlobalBounds()))
- P2.move(0.0, +5 * speed);
- }
- for (int i = 0; i < f; i++)
- {
- if (P2.getGlobalBounds().intersects(box[i].getGlobalBounds()))
- {
- P2.move(0.0, +5 * speed);
- if (P2timer.asSeconds() >= 1)
- {
- if (Joystick::isButtonPressed(0, 6))
- {
- std::cout << " 8 " << std::endl;
- box[i].setPosition(-51, 0);
- P2timer = clock2.restart();
- }
- }
- }
- }
- }
- if (Joystick::isButtonPressed(0, 2) ){
- P2.move(0.0, 5 * speed);
- P2.setTexture(TP2d);
- for (int i = 0; i < n; i++)
- {
- if (P2.getGlobalBounds().intersects(obs[i].getGlobalBounds()))
- P2.move(0.0, -5 * speed);
- }
- for (int i = 0; i < f; i++)
- {
- if (P2.getGlobalBounds().intersects(box[i].getGlobalBounds()))
- {
- P2.move(0.0, -5 * speed);
- if (P2timer.asSeconds() >= 1)
- {
- if (Joystick::isButtonPressed(0, 6))
- {
- box[i].setPosition(-51, 0);
- P2timer = clock2.restart();
- }
- }
- }
- }
- }
- if (Joystick::isButtonPressed(0, 3)) {
- P2.move(-5 * speed, 0.0);
- P2.setTexture(TP2l);
- for (int i = 0; i < n; i++)
- {
- if (P2.getGlobalBounds().intersects(obs[i].getGlobalBounds()))
- P2.move(5 * speed, 0.0);
- }
- for (int i = 0; i < f; i++)
- {
- if (P2.getGlobalBounds().intersects(box[i].getGlobalBounds()))
- {
- P2.move(5 * speed, 0.0);
- if (P2timer.asSeconds() >= 1)
- {
- if (Joystick::isButtonPressed(0, 6))
- {
- box[i].setPosition(-51, 0);
- P2timer = clock2.restart();
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement