Who knows

This commit is contained in:
Benjamin Morgan 2025-09-26 09:26:47 -06:00
parent eaf5a55d18
commit 32e50969b4
45 changed files with 38346 additions and 38306 deletions

218
Ship.cpp
View file

@ -1,109 +1,109 @@
//
// Created by benmo on 2/16/2020.
//
#include "Ship.h"
Ship::Ship(const sf::Texture &texture, float scale, float xPos, float yPos, float velocity, float maxVelocity, float direction, float turnSpeed, int maxFuel, int maxHull, int cargo, int passengers) : GameSprite(texture, scale, round(xPos), round(yPos), velocity, maxVelocity, direction) {
turnRate = turnSpeed;
fullScale = scale;
fuelCap = maxFuel;
fuel = maxFuel;
hullCap = maxHull;
hull = hullCap;
cargoSpace = cargo;
passengerSpace = passengers;
target = nullptr;
}
void Ship::update() {
for (Weapon *w : weapons) {
w->recharge();
}
GameSprite::update();
}
void Ship::shoot(std::vector<Shootable*> &shots) {
for (Weapon *w : weapons) {
if (w->canShoot()) {
shots.push_back(w->shoot(this));
}
}
}
float Ship::getTurnRate() const {
return turnRate;
}
float Ship::getFullScale () const {
return fullScale;
}
int Ship::getFuelCap() const {
return fuelCap;
}
int Ship::getFuelRemaining() const {
return fuel;
}
void Ship::useFuel() {
fuel--;
}
void Ship::setFuel(int _fuel) {
fuel = _fuel;
}
int Ship::getHullCap() const {
return hullCap;
}
int Ship::getHullRemaining() const {
return hull;
}
void Ship::setHull(int _hull) {
hull = _hull;
}
int Ship::getCargoSpace() const {
return cargoSpace;
}
int Ship::getUsedCargoSpace() const {
return cargoUsed;
}
void Ship::setUsedCargoSpace(int _cargoUsed) {
cargoUsed = _cargoUsed;
}
int Ship::getPassengerSpace() const {
return passengerSpace;
}
int Ship::getPassengersAboard() const {
return passengersOn;
}
void Ship::setPassengersAboard(int _passengersOn) {
passengersOn = _passengersOn;
}
Ship * Ship::getTarget() const {
return target;
}
void Ship::setTarget(Ship *_target) {
target = _target;
}
void Ship::addWeapon(Weapon *w) {
weapons.push_back(w);
}
//
// Created by benmo on 2/16/2020.
//
#include "Ship.h"
Ship::Ship(const sf::Texture &texture, float scale, float xPos, float yPos, float velocity, float maxVelocity, float direction, float turnSpeed, int maxFuel, int maxHull, int cargo, int passengers) : GameSprite(texture, scale, round(xPos), round(yPos), velocity, maxVelocity, direction) {
turnRate = turnSpeed;
fullScale = scale;
fuelCap = maxFuel;
fuel = maxFuel;
hullCap = maxHull;
hull = hullCap;
cargoSpace = cargo;
passengerSpace = passengers;
target = nullptr;
}
void Ship::update() {
for (Weapon *w : weapons) {
w->recharge();
}
GameSprite::update();
}
void Ship::shoot(std::vector<Shootable*> &shots) {
for (Weapon *w : weapons) {
if (w->canShoot()) {
shots.push_back(w->shoot(this));
}
}
}
float Ship::getTurnRate() const {
return turnRate;
}
float Ship::getFullScale () const {
return fullScale;
}
int Ship::getFuelCap() const {
return fuelCap;
}
int Ship::getFuelRemaining() const {
return fuel;
}
void Ship::useFuel() {
fuel--;
}
void Ship::setFuel(int _fuel) {
fuel = _fuel;
}
int Ship::getHullCap() const {
return hullCap;
}
int Ship::getHullRemaining() const {
return hull;
}
void Ship::setHull(int _hull) {
hull = _hull;
}
int Ship::getCargoSpace() const {
return cargoSpace;
}
int Ship::getUsedCargoSpace() const {
return cargoUsed;
}
void Ship::setUsedCargoSpace(int _cargoUsed) {
cargoUsed = _cargoUsed;
}
int Ship::getPassengerSpace() const {
return passengerSpace;
}
int Ship::getPassengersAboard() const {
return passengersOn;
}
void Ship::setPassengersAboard(int _passengersOn) {
passengersOn = _passengersOn;
}
Ship * Ship::getTarget() const {
return target;
}
void Ship::setTarget(Ship *_target) {
target = _target;
}
void Ship::addWeapon(Weapon *w) {
weapons.push_back(w);
}