• 0

Visual Basic Board Game Needs Help


Question

Could someone help with my code? Attached is my code and a finished .exe on how my program should work. I cant get the program to start over once a player wins. There's also a few problems that you can see each time a player moves tiles, and I cannot get the player to move up or down tiles if they land on a special tile.

 

Thanks for the help

candyland.zip

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

I have thought about that, I don't know how to make it stay in current position. I've tried subtracting the dice value (int1) by itself. But it keeps going to:

lblArray(LblP1num).Text = CStr(LblP1num)

saying Index was outside the bounds of the array.

There wouldn't have to be any action performed for an object to stay in it's current position. In that case, you could just ignore declaring that particular "If". You have to also think about the next line of code the program goes to after exiting the If statement.

  • Like 1
Link to comment
Share on other sites

  • 0

Also the only way to win is the random number must equal the last tile, if its too high then the player position stays in its spot until the right number is rolled. Right now when it goes over the last tile I get the error index was outside the bounds of array

Link to comment
Share on other sites

  • 0

Please post the relevant code in your message, it's not practical to require people to download your assignment. What have you tried and what specifically isn't working?

Link to comment
Share on other sites

  • 0

The main problem I am having is the player is going over the array number (35), I need the player to stay on the same tile until they roll a number that puts them on 35 so they win

Link to comment
Share on other sites

  • 0

The main problem I am having is the player is going over the array number (35), I need the player to stay on the same tile until they roll a number that puts them on 35 so they win

I'm sure If statements would solve this.

 

Just after dice has been "rolled": If current tile + dice value is greater than 35, stay in current position, else if less than 35 move to position, else (if 35) player wins!

Link to comment
Share on other sites

  • 0

I have thought about that, I don't know how to make it stay in current position. I've tried subtracting the dice value (int1) by itself. But it keeps going to:

lblArray(LblP1num).Text = CStr(LblP1num)

saying Index was outside the bounds of the array.

Link to comment
Share on other sites

  • 0

There wouldn't have to be any action performed for an object to stay in it's current position. In that case, you could just ignore declaring that particular "If". You have to also think about the next line of code the program goes to after exiting the If statement.

Got it working. Thanks for the help

Link to comment
Share on other sites

This topic is now closed to further replies.