StickFigures_in_Space
Ադամանդե Անդամ

Hi! I'm @StickFigures_in_Space right now, but my username changes... a lot.

I specialize in programming in C++, C, and C#, so if you have something interesting to program, I'm your guy.

----------------------------------------------------------------

I have a club (idk the name right now) that's starting soon, pls join.

Here's my most recent project (BeatWaves_1.3)

----------------------------------------------------------------

#include <iostream>
#include <conio.h>
#include <windows.h>
#include <time.h>
#include <thread>

#define Length 20
#define Width 20
#define BeatHead '>'
#define Obstacle '|'

class BeatWaves {
private:
    static char Display[Length][Width];

public:
    static int Score, px, py, ox, oy;
    static bool GameOver, QuitFlag, xFlag;

    BeatWaves() {
        Setup();
    }

    void Setup() {
        GameOver = QuitFlag = false;
        srand((unsigned)time(NULL));
        px = 4;  // Set player position initially
        py = 0;
        Display[px][py] = BeatHead;  // Player starts in the middle of left side

        do {
            ox = rand() % Width;
        } while (ox <= 4);
        oy = rand() % Length;
    }

    void Draw() {
        system("cls");
        std::printf("Welcome to BeatWaves!\n");
        std::printf("Press 'w' to move up! (You move down by default)\n");
        std::printf("------------------------------------------------\n");

        for (int i = 0; i < Length; i++) {
            std::putchar('|');
            for (int j = 0; j < Width; j++) {
                if (i == px && j == py) {
                    std::putchar(BeatHead);
                } else if (i == ox && j == oy) {
                    std::putchar(Obstacle);
                } else {
                    std::putchar(' ');
                }
                std::putchar(' ');
            }
            std::putchar('|');
            std::putchar('\n');
        }
    }

    void Input() {
        if (_kbhit()) {
            switch (_getch()) {
                case 'w':
                    if (px > 0) px--;  // Move up
                    xFlag=true;
                    break;
                case 'q':
                    QuitFlag = true;  // Quit
                    break;
                default:
                    break;
            }
        }
    }

    void CheckStuff() {
        oy--;  // Move obstacle to the left
        if (px < Length - 1&&xFlag==false) px++;
        if (ox == px && oy == py) {
            GameOver = true;  // Collision detection
        }
        if (oy < 0) {
            oy = Width - 1;
            ox = rand() % Length;
        }
        if (px >= Length) px = Length - 1;
        if (py >= Width) py = Width - 1;
    }

    void Run() {
        while (!(GameOver || QuitFlag)) {
            int iterations=0;
            Draw();
            Input();
            CheckStuff();
            Sleep(10);  // Slow down the loop
            Score++;
            xFlag=false;
        }
    }
};

// Initialize static members
char BeatWaves::Display[Length][Width];
int BeatWaves::Score = 0;
int BeatWaves::px = 5;
int BeatWaves::py = 0;
int BeatWaves::ox = 0;
int BeatWaves::oy = 0;
bool BeatWaves::GameOver = false;
bool BeatWaves::QuitFlag = false;
bool BeatWaves::xFlag=false;
BeatWaves game;
void Game(){
    game.Run();

    if (game.QuitFlag == true) {
        std::printf("BeatWaves 1.1 was closed\n");
    } else {
        std::printf("You lost! (good job!) Your score was %d\n", game.Score);
    }
    getchar();
}

void PlayMusic(){
    while(!(game.GameOver || game.QuitFlag)){
        Beep(523, 750);
        Sleep(50);
        Beep(261, 150);
        Sleep(50);
        Beep(261, 150);
        Beep(311, 750);
        Sleep(50);
        Beep(311, 150);
        Sleep(50);
        Beep(261, 750);
        Beep(261, 150);
        Sleep(50);
        Beep(261, 150);
        Beep(392, 750);
        Beep(392, 150);
        Sleep(150);
        Beep(392, 150);
    }
}

int main() {
    std::thread Game/*wow*/(Game);
    std::thread Music(PlayMusic);
    Game.join();
    Music.join();
    return 0;
}

Meanwhile, here are some of my fav. clubs:

Chess Universe: 🌍https://www.chess.com/club/chess-universe/

I supervise there, so it's very special to me.

TCDD (link not provided). Very nice social club

Anyway, I'll tell you some more about myself sometime later. Bio is getting updated soon.

Here's what my game looks like in the console:

---------------------------------------

|

|   >                                     |

|

|

|

----------------------------------------

Yeah, something like that.

Anyway... DM me for some weird C++ tips.

If you want to support my to-be club, give me some good names.

PFP suggestions, as well as username suggestions and club name suggestions are open.

Ակումբներ
Chess Universe
Chess Universe 2 324 թիմակիցներ
Chess.com vs. ChessKid
Chess.com vs. ChessKid 4 684 թիմակիցներ
Kids-Only Club
Kids-Only Club 509 թիմակիցներ
The Club of Debate and Discussion
The Club of Debate and Discussion 391 թիմակիցներ
The Club That Needs A Name
The Club That Needs A Name 126 թիմակիցներ