Map

Im trying to make a map with a moveabe character but as you can see i have no idea what im doing, i actually just dont know where to begin D:

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
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
#include <windows.h>
#define VK_UP 0x57
#define VK_DOWN 0x53
#define VK_LEFT 0x41
#define VK_RIGHT 0x44

using namespace std;

int W;
int A;
int S;
int D;

int X = 0;
int Y = 0;

char character = 'O';
char M = '*';

int main()
{
    char map[10][10] = {{0,1,2,3,4,5,6,7,8,9}, {10,11,12,13,14,15,16,17,18,19}};

    cout << map[X][Y] << endl;

    X = '*';

    cout << X;

    W = GetAsyncKeyState(0x57);
        for (X = 0; X < 10; X++){
            for(Y = 0; Y < 10; Y++){
            }

            cout << endl; // ends the line
}
}
What is the purpose of lines 27 and 29?
You seem to be using X and Y as the index variables to your map, yet you set X to an asterisk, then write it to cout. Why?

You loop through the map, yet you don't do anything. i.e. line 34 is empty.
I told you I have no idea what im doing :p
closed account (o3hC5Di1)
Perhaps this project is slightly too ambitious for you at this point then.
Try coming back to it after trying some other ones and see if you have gained some more understanding.

Some good ideas in Need4Sleep's "daily c++ problem" thread.

All the best,
NwN
Nah, i just need to be shown the proper way to do it and i'll get it, I know how to use arrays and such, the only thing thats confusing is how to actually set this up.
Topic archived. No new replies allowed.