Thread: How to set up text-based character movement in c++

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    67

    How to set up text-based character movement in c++

    Hey everyone, I had a question about character movement for a text base c++ game I wanted to create for sometime. I am fairly new at programming in C++ ( about 6 months) or any other programming language, so I do not know how to make my character move?

    I want to be able to move my character, the "@" sign lol, using the arrow keys. I've tried googling and looking it up on the forums, but I could only find a few which talked not that much about the topic and didn't really have no explanation on how to use or why.

    Does any one know of a link to a good tutorial? Or if any one could write me a fragment of the function ( not a whole program, ofcourse..)
    and explain how it works?

    ,Thanks!!

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Which operating system and compiler are you using?

    Very crudely, you clear the screen and redraw everything in the updated position(s).
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Nov 2011
    Posts
    67
    Quote Originally Posted by Salem View Post
    Which operating system and compiler are you using?

    Very crudely, you clear the screen and redraw everything in the updated position(s).
    My OS is windows, and I am using the compiler Code::Blocks.

    P.S. I do have Microsoft Visual Studios 2010, but I prefer Code::Blocks

  4. #4
    Just a pushpin. bernt's Avatar
    Join Date
    May 2009
    Posts
    426
    Quote Originally Posted by cplusplusnoob
    My OS is windows, and I am using the compiler Code::Blocks.

    P.S. I do have Microsoft Visual Studios 2010, but I prefer Code::Blocks
    Code::Blocks is an IDE, not a compiler - it can use a lot of different compilers, as a matter of fact. If you need to check, it should show up in the Build Options window (or something like that, I haven't used Code::Blocks in a while now).
    Chances are you're using either MinGW or MSVC. IIRC pdcurses should work with either one; it's probably the easiest way to get started with text-related stuff. There's also functionality for doing this in the Windows API.
    Consider this post signed

  5. #5
    Registered User
    Join Date
    Nov 2011
    Posts
    67
    Quote Originally Posted by bernt View Post
    Code::Blocks is an IDE, not a compiler - it can use a lot of different compilers, as a matter of fact. If you need to check, it should show up in the Build Options window (or something like that, I haven't used Code::Blocks in a while now).
    Chances are you're using either MinGW or MSVC. IIRC pdcurses should work with either one; it's probably the easiest way to get started with text-related stuff. There's also functionality for doing this in the Windows API.
    Thanks for the clarification! =) Appreciate it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Character Movement
    By binks in forum C Programming
    Replies: 44
    Last Post: 04-27-2011, 11:45 AM
  2. New game-Time-based movement?
    By napkin111 in forum Game Programming
    Replies: 6
    Last Post: 01-18-2003, 01:50 AM
  3. time-based movement?
    By pode in forum Game Programming
    Replies: 16
    Last Post: 12-21-2002, 06:58 PM
  4. time based movement
    By werdy666 in forum Game Programming
    Replies: 5
    Last Post: 11-04-2002, 01:52 PM