Author |
Message |
KitKat
|
Posted: Sat Dec 06, 2014 2:39 pm Post subject: C++ Version of 2048 |
|
|
Hey guys. I'm completely a beginner in c++ programming and my task is to make my version of 2048 game in c++.
I'm totally confused in the movement controls and don't know how to move elements of my array using keyboard keys.
Please help. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Zren
|
Posted: Sat Dec 06, 2014 3:24 pm Post subject: RE:C++ Version of 2048 |
|
|
Is this a console application? Or are you using a specific graphics library? |
|
|
|
|
|
KitKat
|
Posted: Sun Dec 07, 2014 11:22 am Post subject: RE:C++ Version of 2048 |
|
|
Console application. |
|
|
|
|
|
KitKat
|
Posted: Sun Dec 07, 2014 11:28 am Post subject: RE:C++ Version of 2048 |
|
|
I've read about the switch statement but I guess it involves the use of breaks which I'm not allowed by my instructor. |
|
|
|
|
|
Insectoid
|
Posted: Mon Dec 08, 2014 8:20 pm Post subject: RE:C++ Version of 2048 |
|
|
Are you allowed to have the user hit 'enter' after entering a command or does it have to happen instantly?
you could just scanf a char, check if it's a movement char, then iterate over the array, checking if each element can move in that direction based on the rules of the game.
You will have to change which order you check the indices in depending on the direction of the shift. |
|
|
|
|
|
KitKat
|
Posted: Tue Dec 09, 2014 8:39 am Post subject: RE:C++ Version of 2048 |
|
|
Okay, thankyou. |
|
|
|
|
|
|