Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Roguelike/Character.cpp
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
51 lines (43 sloc)
1.05 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Character.h" | |
char map[15][15] = { //static map in array | |
"**************", | |
"*@ *", | |
"* *", | |
"* G *", | |
"* *", | |
"* *", | |
"* *", | |
"* *", | |
"* *", | |
"* *", | |
"**************" | |
}; | |
void Character::Movement(int Vertical, int Horizontal) | |
{ | |
int x2 = x + Horizontal; // movement on x-axis | |
int y2 = y + Vertical; // movement on y-axis | |
if (map[y][x2] == ' ') // if player moves horizontally the space before becomes an empty space and the space moved to becomes '@' | |
{ | |
map[y][x] = ' '; | |
x += Horizontal; | |
map[y][x] = '@'; | |
} | |
if (map[y2][x] == ' ') // if player moves vertically the space before becomes an empty space and the space moved to becomes '@' | |
{ | |
map[y][x] = ' '; | |
y += Vertical; | |
map[y][x] = '@'; | |
} | |
/*if (map[y][x2] == '-') //attempt at corridors lmao | |
{ | |
map[y][x] = '-'; | |
x += Horizontal; | |
map[y][x] = '@'; | |
} | |
if (map[y2][x] == '|') | |
{ | |
map[y][x] = '|'; | |
y += Vertical; | |
map[y][x] = '@'; | |
}*/ | |
} |