2

The whole Idea is that I give the player 2 seconds to type Dodge or Attack. If they havent typed Dodge or Attack they die. I cant figure out how to break out of the ReadLine. I someone can help me thanks. (C# Console Application)

Lars
  • 21
  • 4

1 Answers1

0

Note that reading from Console is no different that reading from a file, or another stream.

You will have to use threads.

Details here: How to add a Timeout to Console.ReadLine()?

EDIT: Make sure to have using System.Threading if you use that answer.

Community
  • 1
  • 1
Paul Draper
  • 78,542
  • 46
  • 206
  • 285