Not showing last action of maze

This is a discussion on Not showing last action of maze within the C++ Programming forums, part of the General Programming Boards category; Hey guys I am now creating a small maze game. The maze is thus so: Code: const int MAX_ROWS = ...

  1. #1
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,479

    Not showing last action of maze

    Hey guys

    I am now creating a small maze game.

    The maze is thus so:

    Code:
    const int MAX_ROWS = 12,
    			  MAX_COLS = 12;
    
    	char theMaze[ MAX_ROWS ][ MAX_COLS ] = {
    		{'#','#','#','#','#','#','#','#','#','#','#','#'},
    		{'#','.','.','.','#','.','.','.','.','.','.','#'},
    		{'.','.','#','.','#','.','#','#','#','#','.','#'},
    		{'#','#','#','.','#','.','.','.','.','#','.','#'},
    		{'#','.','.','.','.','#','#','#','.','#','.','.'},
    		{'#','#','#','#','.','#','.','#','.','#','.','#'},
    		{'#','.','.','#','.','#','.','#','.','#','.','#'},
    		{'#','#','.','#','.','#','.','#','.','#','.','#'},
    		{'#','.','.','.','.','.','.','.','.','#','.','#'},
    		{'#','#','#','#','#','#','.','#','#','#','.','#'},
    		{'#','.','.','.','.','.','.','#','.','.','.','#'},
    		{'#','#','#','#','#','#','#','#','#','#','#','#'}
    	};
    The program works perfectly so far, but the issue I would like to resolve is when i display the maze after say going SOUTH, how to un-show the previous command?

    A better way to explain woud be this.

    Say I went SOUTH three times, my program would display:

    Code:
    M
    M
    M
    But, I would like it to only show a single M at the the bottom, not showing
    the previous two moves - if you get what I mean

    The 'M' is a const char pointer, and there are functions that move the M in each
    direction pending what is pressed. Is there a way to do this, or do I have to
    re-draw the empty grid again after each new position is set?

    Any help appriciated
    I'm just trying to be a better person - My Name Is Earl

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    You can either draw the whole grid again, or draw '.' where the 'M' used to be.

  3. #3
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,479
    Thanks tabstop
    I'm just trying to be a better person - My Name Is Earl

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Retail Outlet Managment System - the 4th
    By Presidentofusa in forum C Programming
    Replies: 3
    Last Post: 11-10-2007, 10:44 PM
  2. need help on Calculator program in C
    By deathscyth129 in forum C Programming
    Replies: 8
    Last Post: 01-08-2005, 07:50 PM
  3. Directional Keys - Useing in Console
    By RoD in forum C++ Programming
    Replies: 38
    Last Post: 10-06-2002, 05:42 PM
  4. FAQ: Directional Keys - Useing in Console
    By RoD in forum FAQ Board
    Replies: 38
    Last Post: 10-06-2002, 05:42 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21