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.