Sign in to follow this  

Visual Basic Board Game Needs Help

Recommended Posts

soccerstar206    1

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

Share this post


Link to post
Share on other sites
soccerstar206    1

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

Share this post


Link to post
Share on other sites
+Andre S.    1,892

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?

Share this post


Link to post
Share on other sites
soccerstar206    1

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

Share this post


Link to post
Share on other sites
soccerstar206    1

.

Share this post


Link to post
Share on other sites
soccerstar206    1

Share this post


Link to post
Share on other sites
68k    290

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!

Share this post


Link to post
Share on other sites
soccerstar206    1

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.

Share this post


Link to post
Share on other sites
68k    290

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

Share this post


Link to post
Share on other sites
soccerstar206    1

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

Share this post


Link to post
Share on other sites
Aergan    621

I would look at SELECT CASE rather than ElseIf.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.