I am writing to a friend. It is necessary to make a game on the similarity of the arkanoid Tetris in the console, only you need not to shoot a controlled cannon but with a ball.

I see the writing of the game in this way, correct if not so:

  1. create a matrix;
  2. fill it with zeros - these are empty cells;
  3. then I will place the first level on it, for example units;
  4. two for example gun;
  5. the drawing function will be called up regularly and draw in the console that object or gun;

Actually the following questions arose: How to remove the scroll in the console? That is, here's how in the turbo-belts itself: Launched, and nothing scrolls. How do I better intercept keystroke and space (you can assign another key to FIRE)? How to add a delay?

    1 answer 1

    Scrolling will not be there, if you do not get out of the allotted 80x25 characters. To do this, use

    gotoxy(x;y) 

    and before everything -

     clrscr; 

    arrows can be read as follows:

     while KeyPressed do begin key := ReadKey; end; 
    • Oh, there is progress. Thank! I will try. - Jakeroid
    • How to make a delay? - Jakeroid
    • Delay function: for i: = 0 to 10 do begin // ... delay (ms); end; - Leshij_2005
    • Which is hard on me with rendering. Created a World object with an array of Figure objects. Figure has oType, which determines what it is (square, triangle). But how to draw something is not catching up. Well, clrscr and gotoxy is understandable, but with objects of hs .. - Jakeroid
    • one
      It is necessary to write a procedure (or cycle), which as the argument will take the type of the object and the coordinates of the upper left corner. And the body will be something like this: if celltype = "monster" then symbol = "#"; if celltype = "player" then symbol = "@"; if celltype = "empty" then symbol = ""; gotoxy (x; y); write (symbol); gotoxy (x + 1; y); write (symbol); gotoxy (x; y + 1); write (symbol); gotoxy (x + 1; y + 1); write (symbol); - knes