Difference between revisions of "2022 - Allow the player to create a new lock"
(Created page with "=What you need to do= * Create a new method in the BreakThrough class called 'NewLock()'. Now inside this new method: * output the message 'How many conditions' * read in the...") |
(No difference)
|
Revision as of 17:26, 27 November 2021
What you need to do
- Create a new method in the BreakThrough class called 'NewLock()'.
Now inside this new method:
- output the message 'How many conditions'
- read in the players input
- convert the input to an integer
- Create a new lock (eg, Lock temp = new Lock())
- create a for loop using the integer
Now inside the for loop:
- output the message 'Please enter a condtion: '
- read in the players input
- create a challenge by splitting the input (eg List<string> challenge = input.Split(',').ToList(); )
- now add the challenge to the lock (eg temp.AddChallenge(challenge); )
Finally, outside of the for loop:
- add the new lock to the Locks (eg Locks.Add(temp); )
- set the currentLock to the new lock