Help with simple vector game

Ok so i posted something about this but i cannot find my post so here is a new one, now the vector makes a grid but it doesnt place my O character in the grid and i cant move it. Also it beeps when the program starts, why is that??

CODE:


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
#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';

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}};

    W = GetAsyncKeyState(0x57);
        for (X = 0; X < 10; X++){
            for(Y = 0; Y < 10; Y++){
                   cout << map[X][Y] << endl;
            }

            cout << endl; // ends the line
}
}
but it doesnt place my O character

Why would it? Where in your code do you something to try to place character in the grid?

Also it beeps when the program starts, why is that?
The character with the numerical representation 7 is the BEL character. Commonly, this is interpreted by the OS as a beeping noise.
Last edited on
Ok im lost again D: Can you show me an example using my code?
Example of what?
Example of the character moving in the grid, or at least tell me what things need to be done and how i should do it.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
#include <cstring>
using namespace std;

char character = 'O';

int main()
{
  int x=0;
    while (x<100)
   { char map[100];
     memset (map, '.', 100); map[x] = character;
      for (int y=0; y<10;++y)
      {
          for (int z=0; z<10;++z) 
          {
             cout << map[y*10 + z];
          }
      cout << endl; // ends the line
      }
     x++;cout << endl; // add a suitable SLEEP call here if you want to see it all
   }
      
}
Last edited on
Topic archived. No new replies allowed.