I am trying to create a program that will randomly generate rooms as the user presses the arrow keys, and it's been working fine, but I've hit a bit of a snag. I'm trying to get the key press commands working, but no matter how long I look at the code, I can't figure out why the little figure I have made isn't moving.
I've included the entire file for the program, but here is where I think the problem is taking place:
while(SDL_PollEvent(&Event))
{
if(Event.type == SDL_KEYDOWN)
{
if (Event.key.keysym.sym)
{
if (SDL_KEYDOWN == SDLK_UP)
{
if (PlayerLocationy == 0)
{
Message = DeniedMessage;
ApplySurface((ScreenWidth - Message->w)/2,(ScreenHeight - Message->h + 420)/2,Message,Screen,NULL);
Message == NULL;
}
else
{
PlayerLocationy =- 42;
ApplySurface(0,421,Sprites,Screen,&TextBox);
}
}
if (SDL_KEYDOWN == SDLK_DOWN)
{
if (PlayerLocationy == 378)
{
Message = DeniedMessage;
ApplySurface((ScreenWidth - Message->w)/2,(ScreenHeight - Message->h + 420)/2,Message,Screen,NULL);
Message == NULL;
}
else
{
PlayerLocationy =+ 42;
ApplySurface(0,421,Sprites,Screen,&TextBox);
}
}
if (SDL_KEYDOWN == SDLK_LEFT)
{
if (PlayerLocationx == 0)
{
Message = DeniedMessage;
ApplySurface((ScreenWidth - Message->w)/2,(ScreenHeight - Message->h + 420)/2,Message,Screen,NULL);
Message == NULL;
}
else
{
PlayerLocationx =- 42;
ApplySurface(0,421,Sprites,Screen,&TextBox);
}
}
if (SDL_KEYDOWN == SDLK_RIGHT)
{
if (PlayerLocationy == 0)
{
Message = DeniedMessage;
ApplySurface((ScreenWidth - Message->w)/2,(ScreenHeight - Message->h + 420)/2,Message,Screen,NULL);
Message == NULL;
}
else
{
PlayerLocationy =+ 42;
ApplySurface(0,421,Sprites,Screen,&TextBox);
}
}
if (SDL_KEYDOWN == SDLK_UP)
{
Message == EscapeMessage;
ApplySurface((ScreenWidth - Message->w)/2,(ScreenHeight - Message->h + 420)/2,Message,Screen,NULL);
if (SDL_KEYDOWN == SDLK_y)
{
QUIT == true;
}
}
}
}
if(Event.type == SDL_QUIT)
{
QUIT = true;
}
}
Any help that could be given would be very much appreciated. I have a feeling it's something smal like a missing = sign that I can't find, but maybe another programmer would be able to see what I have not.
Thank you in advance
-Programmer557
[attachment=15821:Randomized Maze Game.zip]