Skip to content
Permalink
ff3da6ec0f
Switch branches/tags

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?
Go to file
 
 
Cannot retrieve contributors at this time
51 lines (43 sloc) 1.05 KB
#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] = '@';
}*/
}