Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <windows.h>
- #include <thread>
- using namespace std;
- class Variables {
- public:
- float Money = 0;
- float MoneyForClick = 1;
- float MoneyPerSecond = 1;
- float UpgradeMultiplicator = 2;
- float AutoclickerUpgradeMultiplicator = 1.5;
- float UpgradeLevel = 0;
- float UpgradeCost = 10;
- float AutoclickerUpgradeLevel = 0;
- float AutoclickerUpgradeCost = 10;
- bool GameIsFinished = false;
- void ShowGameData() {
- system("cls");
- cout << "------------------------------------------------" << endl;
- cout << "Money: " << Money << endl;
- cout << "------------------------------------------------" << endl;
- cout << "Money for click: " << MoneyForClick << endl;
- cout << "Money per second: " << MoneyPerSecond << endl;
- cout << "------------------------------------------------" << endl;
- cout << "Upgrage level: " << UpgradeLevel << endl;
- cout << "Autoclicker upgrage level: " << AutoclickerUpgradeLevel << endl;
- cout << "------------------------------------------------" << endl;
- cout << "Upgrage cost: " << UpgradeCost << endl;
- cout << "Autoclicker upgrage cost: " << AutoclickerUpgradeCost << endl;
- cout << "------------------------------------------------" << endl;
- cout << endl;
- cout << "Press 'u' to upgrade amount money for click" << endl;
- cout << "Press 'a' to upgrade amount money per second" << endl;
- cout << "Press 'l' to finish this game" << endl;
- }
- };
- void AutoClicking(Variables *GameVariables);
- int main() {
- Variables GameVariables;
- float *Money = &GameVariables.Money;
- float *MoneyForClick = &GameVariables.MoneyForClick;
- float *MoneyPerSecond = &GameVariables.MoneyPerSecond;
- float *UpgradeLevel = &GameVariables.UpgradeLevel;
- float *UpgradeCost = &GameVariables.UpgradeCost;
- float *AutoclickerUpgradeLevel = &GameVariables.AutoclickerUpgradeLevel;
- float *AutoclickerUpgradeCost = &GameVariables.AutoclickerUpgradeCost;
- float *UpgradeMultiplicator = &GameVariables.UpgradeMultiplicator;
- float *AutoclickerUpgradeMultiplicator = &GameVariables.AutoclickerUpgradeMultiplicator;
- thread AutoClickingTh(AutoClicking, &GameVariables);
- GameVariables.ShowGameData();
- AutoClickingTh.detach();
- while (!GameVariables.GameIsFinished) {
- char Input;
- Input = getche();
- switch (Input) {
- case ' ':
- *Money += *MoneyForClick;
- break;
- case 'u':
- if (*Money >= *UpgradeCost) {
- *MoneyForClick *= *UpgradeMultiplicator;
- *Money -= *UpgradeCost;
- *UpgradeLevel += 1;
- *UpgradeCost *= 2 * *UpgradeMultiplicator;
- }
- break;
- case 'a':
- if (*Money >= *AutoclickerUpgradeCost) {
- *MoneyPerSecond *= *AutoclickerUpgradeMultiplicator;
- *Money -= *AutoclickerUpgradeCost;
- *AutoclickerUpgradeLevel += 1;
- *AutoclickerUpgradeCost *= 2 * *AutoclickerUpgradeMultiplicator;
- }
- break;
- case 'l':
- GameVariables.GameIsFinished = true;
- break;
- }
- GameVariables.ShowGameData();
- }
- }
- void AutoClicking(Variables *GameVariables) {
- while (!GameVariables->GameIsFinished) {
- Sleep(1000);
- GameVariables->Money += GameVariables->MoneyPerSecond;
- GameVariables->ShowGameData();
- }
- }
Add Comment
Please, Sign In to add comment