0

Expected expression help

I'm trying to implement a WASD key input for a snake game and can't seem to get why im getting an error Notes: I'm using Xcode on MacOs and language is C++ here's the input code. void Input() { if (getchar() ({ switch _getch(); { case 'a': dir = LEFT; break; case 'w': dir = UP; break; case 's': dir = RIGHT; break; case 'd': dir = DOWN; break; case 'x': gameOver = true; break; } } }

19th Jul 2019, 8:36 PM
Silvester
Silvester - avatar
1 Answer
+ 3
It's kind of confusing... On the third line, I don't know what you tried to achieve but you probably just confused a starting round bracket with a closing one :/
19th Jul 2019, 8:56 PM
Airree
Airree - avatar