Animate Pic

Dixie77

Board Regular
Joined
Nov 13, 2011
Messages
53
Hi All,

I've been asked to devise a basic snakes and ladders game for a bit of fun in the office and I've got most of the code sorted (thanks to people on here and the internet :))

But I've come up against a little problem, due to the number of people who will be using the game (9 people) I need a way to move their individual pictures around the board, I initially thought using different colour's within conditional formatting would work but this is only good for 3 people :oops:

Is it possible to move the pictures ??

Any help would be great,

Rob
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Hi Erik,

Do you want me to upload the code or workbook?
I'm not sure how to do the workbook, can you give me any pointers?

It was decided to give the players some interaction so they will be moving their own markers around the board, instead of letting the code do the work as this would be to quick.

Rob
 
Upvote 0
Hi Erik,

Do you want me to upload the code or workbook?
I'm not sure how to do the workbook, can you give me any pointers?

It was decided to give the players some interaction so they will be moving their own markers around the board, instead of letting the code do the work as this would be to quick.

Rob
Code can be made to let the markers move slowly.
If you want, you can use my emailadres. (see my signature)
Else you can upload it to share with everybody.
 
Upvote 0
Hi Erik,

Thought I'd upload the code for everyone to have a look at and use if they like,

Option Explicit
Sub Button14_Click()
'Roll the dice
Dim v As Integer
Dim cv As Integer
Dim NewTotal As Integer
v = Roll
cv = Cells(8, 14).Value
Range("M1:O3").Select
Selection.Font.ColorIndex = 1
Cells(1, 13) = v
NewTotal = cv + v
If NewTotal > 100 Then Exit Sub
Do
cv = cv + 1
Cells(8, 14) = cv
Loop Until cv = NewTotal

Cells(8, 14) = NewTotal
Cells(8, 14) = SnakesLadders(NewTotal)

If NewTotal = 100 Then
Cells(1, 13) = "WIN"
Cells(9, 14) = Cells(9, 14) + 1
End If
End Sub
Function Roll()
Do
Roll = Int(Rnd * 6.15 + 0.5)
Loop While (Roll = 0 Or Roll > 7)
End Function
Sub Button17_Click()
'roll the dice
Dim v As Integer
Dim cv As Integer
Dim NewValue As Integer
v = Roll
cv = Cells(8, 15).Value
NewValue = cv + v
Range("M1:O3").Select
Selection.Font.ColorIndex = 1
Cells(1, 13) = v
If NewValue > 100 Then Exit Sub
Do
cv = cv + 1
Cells(8, 15) = cv
Loop Until cv = NewValue
Cells(8, 15) = NewValue
Cells(8, 15) = SnakesLadders(NewValue)
If NewValue = 100 Then
Cells(1, 13) = "WIN"
Cells(9, 15) = Cells(9, 15) + 1
End If
Application.Calculate
End Sub
Function SnakesLadders(Param As Integer)
Select Case Param

'Snakes
Case 23: SnakesLadders = 1
Case 67: SnakesLadders = 37
Case 70: SnakesLadders = 49
Case 82: SnakesLadders = 58
Case 96: SnakesLadders = 77

'Ladders
Case 41: SnakesLadders = 62
Case 57: SnakesLadders = 78
Case 4: SnakesLadders = 25
Case 14: SnakesLadders = 48
Case 65: SnakesLadders = 87
Case 53: SnakesLadders = 72

Case Else
SnakesLadders = Param
End Select

End Function

Sub Button18_Click()
''NewGame
Cells(8, 15) = 0
Cells(8, 14) = 0
Cells(8, 16) = 0
Cells(8, 17) = 0
Cells(8, 18) = 0
Cells(8, 19) = 0
Cells(8, 20) = 0
Cells(8, 21) = 0
Cells(1, 13) = 0
End Sub


Although the markers can be made to move more slowley, people thought it would have taken some of the fun out of the game if they just watched the marker move. It will be something I look into in the future as it might come in useful in other ways.

Thanks again for all your assistance,

Rob
 
Upvote 0
Hi Erik,

There are no special setups required,

I'm running it on Excel 2003 with no problems, not sure about later / earlier editions.

Regards

Rob
 
Upvote 0
But, when clicking those buttons there are just some numbers changing.
In what range is it played, wat formats are applied, etcetera?
 
Upvote 0
Hi Erik,

Apologies if this is a silly question but are you refering to where the game board is set up? If so the range is from B2-K10

Sorry if this is not what your asking, if you could let me know I'll get back to you :oops:

Thanks

Rob
 
Upvote 0
Problem is I do not know exactly how snakes and ladders is played.
When you use an empty spreadsheet and just run the code, nothing will be visible except some numbers changing.
So can you explain what we need to do to prepare the sheet?
 
Upvote 0
Hi Erik,

I have attached a screen shot of the layout required, when the persons button is pressed a random number between 1-6 appears in cells 1,13 (like a dice)
This then allows the user to move their marker around the board, underneath the persons number is the actual number the user should be on. It takes into account any snakes (red arrows) that you need to slide down and ladders (blue arrows) that you can climb.



-- removed inline image ---


Hope this is of some help,

Regards

Rob
 
Upvote 0

Forum statistics

Threads
1,215,045
Messages
6,122,836
Members
449,096
Latest member
Erald

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top