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. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Zren
![](http://compsci.ca/v3/uploads/user_avatars/1110053965512db6185954b.png)
|
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? |
|
|
|
|
![](images/spacer.gif) |
KitKat
|
Posted: Sun Dec 07, 2014 11:22 am Post subject: RE:C++ Version of 2048 |
|
|
Console application. |
|
|
|
|
![](images/spacer.gif) |
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. |
|
|
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
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. |
|
|
|
|
![](images/spacer.gif) |
KitKat
|
Posted: Tue Dec 09, 2014 8:39 am Post subject: RE:C++ Version of 2048 |
|
|
Okay, thankyou. |
|
|
|
|
![](images/spacer.gif) |
|