Like Tree1Likes
  • 1 Post By bernt

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

This is a discussion on How to set up text-based character movement in c++ within the Game Programming forums, part of the General Programming Boards category; Hey everyone, I had a question about character movement for a text base c++ game I wanted to create for ...

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,338
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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.
    Salem likes this.
    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 if collision logic
    By newn in forum Game Programming
    Replies: 5
    Last Post: 10-26-2011, 11:49 PM
  2. Character Movement
    By binks in forum C Programming
    Replies: 44
    Last Post: 04-27-2011, 11:45 AM
  3. New game-Time-based movement?
    By napkin111 in forum Game Programming
    Replies: 6
    Last Post: 01-18-2003, 12:50 AM
  4. time-based movement?
    By pode in forum Game Programming
    Replies: 16
    Last Post: 12-21-2002, 05:58 PM
  5. time based movement
    By werdy666 in forum Game Programming
    Replies: 5
    Last Post: 11-04-2002, 12:52 PM

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