Skip to content
Snippets Groups Projects
Commit c8a901e6 authored by Ori Almog's avatar Ori Almog
Browse files

Basic map working

parent 5fe42010
No related branches found
No related tags found
No related merge requests found
a.out 0 → 100755
File added
auto 0 → 100644
#!/bin/bash
rm a.out
clear
g++ main.cpp -std=c++11
./a.out
main.cpp 0 → 100644
#include <iostream>
#include <vector>
using namespace std;
void printMap(vector<vector<char>> map) {
cout << "+-";
for (int i = 0; i < map.size(); i++){
cout << "--";
}
cout << '+' << endl;;
for (vector<char> i : map) {
cout << '|';
for (char j : i){
cout << ' ' << j;
}
cout << " |" << endl;
}
cout << "+-";
for (int i = 0; i < map.size(); i++){
cout << "--";
}
cout << '+' << endl;
}
vector<vector<char>> getMap(int playerX, int playerY, int mapSize){
vector<vector<char>> map(mapSize);
for (int i = 0; i < map.size(); i++){
map[i] = vector<char>(mapSize);
}
int k = 0;
for (vector<char>& i : map) {
for (char& j : i){
j = ' ';
}
}
map[playerY][playerX] = '#';
return map;
}
int main() {
cout << "Welcome to RogueReborn" << endl;
printMap(getMap(5,5,10));
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment