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.

Recommended Answers

All 4 Replies

Time_key is set to 100 so your criteria is never met.

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

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

oh well, its good to hear you fixed it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.