hallo,
bei einer switch anweisung die ich über die Tastenabfragen erstellt habe, trat ein Fehler auf:
"Die Bezeichnung case 68 kommt bereits in dieser Switchanweisung vor"
was hat das zu bedeuten:
Hier der Code:
|
C#-Quelltext
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
public enum Keypress
{
MoveLeft = ConsoleKey.A,
MoveRight = ConsoleKey.D,
MoveUp = ConsoleKey.W,
Movedown = ConsoleKey.D,
}
protected virtual void Move(string ausgabe)
{
velocity = Convert.ToDouble(Console.Read());
Console.WriteLine("Your Legend is moving while u press enter");
Keypress keypress = Keypress.MoveUp;
switch (keypress)
{
case Keypress.MoveUp:
Console.WriteLine("Your Legendsis moving up");
break;
case Keypress.Movedown:
Console.WriteLine("Your Legend is moving down");
break;
case Keypress.MoveLeft:
Console.WriteLine("Your Legends is moving left");
break;// bei moving right kommt diese Fehlermeldung
case Keypress.MoveRight:
Console.WriteLine("Your Legend is moving right");
break;
}
|