View Single Post
getting to repeat spins
Junior Member
Status: Offline
Posts: 9
Join Date: Jul 2018
Default getting to repeat spins - 07-24-2018, 09:07 PM

It's looks like from your screen shot you need to create another method where the user isn't asked how many spins they would like and use that in the loop. I would call this method spins_repeated. This will be the same as your SheriffSpin method only the statement asking the user for spins will be left out. A simple form would be sheriff move up/ sheriff turn/ sheriff move done. To make sure the object completes the same number of spins again you'll want to make a number variable in the sheriff's properties called spin. It is important that this variable is used in both SheriffSpin with value set as "asking user for number of spins" and again in spins_repeat as sheriff turn value so that it remains the same. Now in MyFirstMethod you will keep everything the same except what is in the if loop section. Instead of SheriffSpin method replace it with Spins_repeated and add your askuser2 variable with the set value of " asking the user yes or no". This should allow the object to repeat the same amount of spins again if the user selects yes to run the program again. It will continue this way until no is selected or the program is restarted and a new number of spins is input. I hope this is what you were looking for and it helps!
Reply With Quote