Wednesday 29 May 2013

Back!

Right. So yesterday, I managed to make the forward button work. Now, I've been trying to make it so the buttons aren't clickable if there is no room up ahead, or if it isn't a dead end. I've managed to do that with the back button in the starting room, but now when I move forward into a room that I haven't made yet, the program crashes. The way how I'm stopping the buttons from being clicked is by using an if statement to see if the character is in a specific room. If the character is in a room that doesn't have a forward room, I make the room equal to that room.
...Showing it might make more sense.

if(roomArray[cRow][cCol]==roomArray[2][0]) //if character's place on board is same as starting room
{
    roomArray[2][0]=roomArray[cRow][cCol]; //the starting room now equals to the character room
    prev=false; //button for previous room equals false (not sure if this is even needed)
}

That will basically keep them inside the current room. But if that's how it is, then I think I'm going to have waaaaaay too many if statements for this one thing. Doesn't sound right. At all. Or it should, since it works, but I don't think that it's the efficient way to program this bit.

Anyways. That's how it looks to be programmed at the moment!

No comments:

Post a Comment