- Joined
- Jan 27, 2015
- Messages
- 4,999
- Trophies
- 1
- Location
- Behind a screen reading news
- XP
- 4,885
- Country
So I am making a random maze game for 3DS I am posting in the EoF so I do not receive a lot of hate. Here is my code for moving the character. It compiles with no errors but the character will not move.
//player move up
if (kDown & KEY_UP)
{
if(playerPos.y > 0 && map[playerPos.x][playerPos.y-1].walkable)
{
playerPos.y--;
}
}
//player move udown
if (kDown & KEY_DOWN)
{
if (playerPos.y < MapHeight -1 && map[playerPos.x][playerPos.y+1].walkable)
{
playerPos.y++;
}
}
//player move right
if (kDown & KEY_RIGHT)
{
if(playerPos.x < MapWidth -1 && map[playerPos.x][playerPos.x+1].walkable)
{
playerPos.y++;
}
}
//player move left
if (kDown & KEY_LEFT)
{
if(kDown & KEY_LEFT && playerPos.x < MapWidth -1 && map[playerPos.x][playerPos.x-1].walkable)
{
playerPos.y--;
}
}
//player move up
if (kDown & KEY_UP)
{
if(playerPos.y > 0 && map[playerPos.x][playerPos.y-1].walkable)
{
playerPos.y--;
}
}
//player move udown
if (kDown & KEY_DOWN)
{
if (playerPos.y < MapHeight -1 && map[playerPos.x][playerPos.y+1].walkable)
{
playerPos.y++;
}
}
//player move right
if (kDown & KEY_RIGHT)
{
if(playerPos.x < MapWidth -1 && map[playerPos.x][playerPos.x+1].walkable)
{
playerPos.y++;
}
}
//player move left
if (kDown & KEY_LEFT)
{
if(kDown & KEY_LEFT && playerPos.x < MapWidth -1 && map[playerPos.x][playerPos.x-1].walkable)
{
playerPos.y--;
}
}