CSCE-A201 / Disaster-on-Dysnomia

Text based RPG for CSCE A201
0 stars 0 forks source link

Programming Conventions #10

Closed thatcherty closed 2 months ago

thatcherty commented 3 months ago

Proposed Conventions

Classes

Game Loop Requirements

Important Game methods

While Loop

while (Cockpit.get_status() != 1) {
    Hallway.loop();
    switch (Hallway.get_choice()) {
        case 'a':
            player.set_location() = ENGINE_ROOM;
            EngineRoom.loop();
            break;
        case 'b':
            player.set_location() = COCKPIT;
            Cockpit.loop();
            break;
        case ...:
            break;
        default:
            Hallway.movement();
            break;
    }
}

Function idea

void cockpit(&game_win, enigne_room.get_status(), player.get_copilot()) {
    output narrative;
    check conditions;
    return no value
}

Class idea

class Hallway {
    public:
        void movement(&char);

    private:
        char playerChoice;
}

void Hallway::loop(char &playerChoice) {
    output movement options;
    input validation;
    take player input > choice;
}
thatcherty commented 2 months ago

16 Provides the main.cpp and classes.cpp