0

Ok, this Program was supposed to make the asterisk go down a line every 1 second and to be able to move right and left, It moves right and left but it doesn't go down. For Those wondering, yeah im trying to make an arkanoid or something like that... this is just a test not the game project.

{*** Escrito por Fernando Agustin Monti ***}
{************ Padron 90449 ****************}
Program Ironman;

Uses crt;

var
  iTime,iPosX,iPosY:integer;
  cKey:char;
  bGameOver:boolean;
const
  Time_Key = 100;
  X_Screen = 79;
  Y_Screen = 24;
  A_r = #26;
  A_l = #27;

Begin
  ClrScr;
  iPosX := x_Screen div 2;
  iPosY := 2;
  bGameOver := False;
  WHILE not bGameOver DO
    Begin
      Gotoxy (iPosX,iPosY); write('*');
      Delay (Time_Key);
      Gotoxy (iPosX,iPosY); write(' ');
      iTime := iTime + Time_Key;
      IF keypressed THEN
        Begin
          cKey := readkey;
          IF (cKey = A_r) AND (iPosX <= X_Screen) THEN inc(iPosX)
          ElSE IF (cKey = A_l) AND (iPosX > 1) THEN dec(iPosX)
        END;
      IF (Time_Key > 1000) THEN
        Begin
          inc(iPosY);
          iTime := 0;
          bGameOver := iPosY = Y_Screen;
        END;
    END;
END.
2
Contributors
4
Replies
5
Views
9 Years
Discussion Span
Last Post by LizR
0

Thanks. X.x i guess iTime was supposed to go there i will try again

0

Thanks It works now, i had to change Time_Key for iTime =P, my browser crashed and finished with a double post >.<

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.