Thanks! ^^
Here is the code if you were interested.
Code code:
#include <iostream>
#include "windows.h"
using namespace std;
int totalWidth = 460;
char map1[] = {
"111100000011111111000000000000000001111Z"
"100100000010000001000000000000000001001Z"
"100100000010000001000000000000000001001Z"
"100100000011111211000000000000000001001Z"
"112100000000000000000000000000000001121Z"
"000000000000000000000000000000000000000Z"
"000000000000000000000000000000000000000Z"
"000000000000000000000000000000000000000Z"
"000000000000000000000000000000000000000Z"
"000000000000000000000000000000000000000Z"
"000000000000000000000000000000000000000Z"
};
void playerHelp()
{
cout << "* Arrow keys to move *" << endl;
cout << "* Escape key to exit*" << endl;
}
void drawMap1()
{
for(int i=0; i<totalWidth; i++)
{
switch(map1[i])
{
case '0':
cout << '.';
break;
case '1':
cout << (char)219;
break;
case '2':
cout << '/';
break;
case 'Z':
cout << endl;
break;
default:
break;
}
}
}
int main()
{
while(!GetAsyncKeyState(VK_ESCAPE))
{
system("cls");
drawMap1();
playerHelp();
system("pause>nul");
}
cout << "\nGame Exited";
return 0;
}
Guess I'm going to have to change it now though ^^
Haha I have a feeling I won't be able to make movement happen inside the strings, so I might have to go back to arrays after all ^^' I guess I'll do some research on arrays and learn every tiny detail behind how they work and how they can be applied and take a 3rd swing at it xD
-----
I'm thinking.. is it possible to change what has been displayed without disturbing the entire thing or causing a new display to spawn?
For example just imagine I have my room there
#####
#.o....#
#...... #
##..# # can I cause this o to be swapped with the next_y or next_x position without having to redraw the entire thing and cause the flash?
-----
Ah, seems what I really need to know at the moment is how to make header files.
I think I'm just going to go through the entire C++ Essentials Guide over a week or so and download the Eclipse or Code::Blocks IDE.
I've been using a really outdated and old one called Dev C++ but I kinda liked it since it was simple and I didn't need to know anything about C++ to set it up ^^'
After I've studied I'll try again with knowledge behind what I'm using and actually knowing how to create header files and perhaps I'll understand how to do this part without too much confusion:
"On the main page you can find detailed information about the console library and how to use it. Feel free to take a look there if you have any questions. But just to cover the basics, all examples require the following files to be present in your project when you build:
Static library for the Console interface:
if you're using a GCC-based compiler (like MinGW), use libConsole.a
if you're using Microsoft Visual Studio, use Console.lib
Header file to tell your compiler what's available in the console interface library. This is cleverly named Console.h.
When building on a GCC-based compiler, remember that you'll need to add "-L. -lConsole" to your command line, for example, to build the example project for this article, the command line should look something like "gcc -Wall article1.cpp -L -lConsole -o Article1.exe""
Last edited by souldevilj; Feb 19, 2014 at 12:23 PM.
Reason: <24 hour edit/bump