Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //main.cpp
- std::vector <bullet> bullets;
- bullets.push_back(bullet(true, 25.0, sf::Vector2f(30, 40)));
- bullets.push_back(bullet(false, 30.0, sf::Vector2f(0, 0)));
- bullets.push_back(bullet(false, 31.0, sf::Vector2f(20, 0)));
- std::cout << "Skończyłem tworzyć obiekty.\n";
- bullets.erase(bullets.begin());
- bullets.erase(bullets.begin());
- bullets.erase(bullets.begin());
- std::cout << "Usunąłem obiekty.\n";
- //bullet_c.h
- #ifndef bullet_c_h
- #define bullet_c_h
- #include <SFML/Graphics.hpp>
- #include <string>
- #include <iostream>
- class bullet {
- sf::Vector2f pos;
- bool playerIsShooter;
- float vel;
- public:
- bullet(bool pIS, float v, sf::Vector2f p);
- ~bullet();
- bool if_pIS();
- };
- #endif
- //bullet_c.cpp
- #include "bullet_c.h"
- bullet::bullet(bool pIS, float v, sf::Vector2f p): playerIsShooter(pIS), vel(v), pos(p) {
- std::cout << "Bullet at x: " << pos.x << " y: " << pos.y << " with velocity: " << vel << " created. Player is a shooter: " << playerIsShooter << "\n";
- }
- bullet::~bullet() {
- std::cout << "Bullet removed! \n";
- }
- bool bullet::if_pIS() {
- return this->playerIsShooter;
- }
Advertisement
Add Comment
Please, Sign In to add comment