ClearScreen so bad you cant see anything

This is a discussion on ClearScreen so bad you cant see anything within the C++ Programming forums, part of the General Programming Boards category; Invaderz game: original one: just help me: need more: just ask: #include <iostream.h> #include <conio.h> #include <dos.h> #include <stdlib.h> #include ...

  1. #1
    Flash Animator, OF DOOOOM bluehead's Avatar
    Join Date
    Nov 2001
    Posts
    269

    ClearScreen so bad you cant see anything

    Invaderz game: original one: just help me: need more: just ask:

    #include <iostream.h>
    #include <conio.h>
    #include <dos.h>
    #include <stdlib.h>
    #include <fstream.h>

    int x = 10;
    int y = 24;
    int bx = 1;
    int by = 5;
    int bux;
    int buy;
    int lorr = 0;
    int bull = 0;
    int tmer = 0;

    int main()
    {
    while(1)
    {
    gotoxy(x, y);
    putch('^');
    gotoxy(bx, by);
    putch('-');
    if (tmer == 100)
    {
    if (bx == 1)
    bull = 0;
    if (bx == 80)
    bull = 1;
    if (bull == 1)
    bx = bx - 1;
    if (bull == 0)
    bx = bx + 1;
    tmer = 0;
    }
    if (kbhit())
    {
    char movement = getch();

    if (movement == 27)
    break;

    if (movement == 75)
    {
    if (x != 1)
    x = x - 1;
    }

    if (movement == 77)
    {
    if (x != 80)
    x = x + 1;
    }
    }
    tmer = tmer + 1;
    delay(1);
    clrscr();
    }
    return 0;
    }


    borland C 3.1
    Code:
    #if _emo
      #define stereo_type_i_dislike
    #endif

  2. #2
    Registered User
    Join Date
    Jan 2002
    Posts
    387
    >>if (movement == 27)
    >>break;

    why do you put break?
    this isnt switch structure

  3. #3
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,230
    wait...are you mad because ClearScreen is clearing the screen? That's what the title sounds like...LOL...

  4. #4
    Flash Animator, OF DOOOOM bluehead's Avatar
    Join Date
    Nov 2001
    Posts
    269
    i put break there so it'll break outta the while statement which will end the program ^_^

    -----------------------------------------------------------------------

    Im using clrscr(); so that it wount have a trail of movement, but, its being used to often and you cant see yourself nor the badguy
    Code:
    #if _emo
      #define stereo_type_i_dislike
    #endif

  5. #5
    Registered User
    Join Date
    Jan 2002
    Posts
    387
    Originally posted by bluehead
    i put break there so it'll break outta the while statement which will end the program ^_^
    Oh ok i am a bit of a newbie at C++ :-D

  6. #6
    Flash Animator, OF DOOOOM bluehead's Avatar
    Join Date
    Nov 2001
    Posts
    269
    oohh ok hehe welcome to C++!
    Code:
    #if _emo
      #define stereo_type_i_dislike
    #endif

  7. #7
    I'm Back
    Join Date
    Dec 2001
    Posts
    556
    delay(1) 1=msec
    put sleep(1) or delay(1000);

    also

    you don't need to clear whole screen just clear the cols where the character was previously.

  8. #8
    Flash Animator, OF DOOOOM bluehead's Avatar
    Join Date
    Nov 2001
    Posts
    269
    how do you NOT clear the whole screen?or how do you prevent cols where the character was previously?
    Code:
    #if _emo
      #define stereo_type_i_dislike
    #endif

  9. #9
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    use gotoxy to goto the point and then print out a space.

  10. #10
    Flash Animator, OF DOOOOM bluehead's Avatar
    Join Date
    Nov 2001
    Posts
    269
    heh what a good idea
    Code:
    #if _emo
      #define stereo_type_i_dislike
    #endif

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. bad and fail of steam
    By George2 in forum C++ Programming
    Replies: 8
    Last Post: 02-19-2008, 02:07 AM
  2. Can you still view the bios screen with a bad CPU?
    By HyperCreep in forum Tech Board
    Replies: 4
    Last Post: 12-31-2006, 05:57 PM
  3. data loss bad bad bad
    By RoD in forum Tech Board
    Replies: 4
    Last Post: 05-01-2003, 12:06 PM
  4. Shocking(kind of)
    By Shadow in forum A Brief History of Cprogramming.com
    Replies: 25
    Last Post: 12-10-2002, 07:52 PM
  5. UNICODE and GET_STATE
    By Registered in forum C++ Programming
    Replies: 1
    Last Post: 07-15-2002, 03:23 PM

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