Pascal/Turbo Pascal - Alguien que de favor me ayude con este programita

 
Vista:

Alguien que de favor me ayude con este programita

Publicado por natalia (1 intervención) el 04/05/2013 00:07:18
tengo este programa y debo usar procedure en las partes donde estan los gotoxy que son las que separe con un renglón pero sinceramente no se como quedaría, de antemano las gracias a quien sea tan amable de orientarme

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
program mover;
uses crt;
const knesc=#27;
kbarr=#72;{flecha arriba}
kabj=#80{flecha abajo}
kbiz=#75; {flecha izquierd}
kdere=#77; {flecha derecha}
var x,y:integer;
movida, salida:char;
procedure pantalla;
begin
textbackground (red); textcolor (yellow);
clrscr;
gotoxy (2,1); write('presione esc para salir');
gotoxy (2,25); write ('use las flechas para moverse');
window(1,2,80, 40); textbackground (black); textcolor (white);
clrscr;
end;
 
 
begin
pantalla;
x:=30;
y:=12;
gotoxy (x,y); write('*'); gotoxy (x-1,y);write('*');
end;
 
 
if movida=kbiz then
begin
x:= x-1;
gotoxy(x,y); write('*'); gotoxy (x+1,y);write('');end;
 
 
if movida kabj then
begin
y:=y+1;
gotoxy(x,y); write('*'); gotoxy( x,y-1); write (''); end;
 
 
if movida = kbarr then
begin
y:=y-1;
gotoxy(x,y); write('*'); gotoxy(x,y+1);write(''); end;
until movida = knesc;
end.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Alguien que de favor me ayude con este programita

Publicado por ramon (2158 intervenciones) el 05/05/2013 18:13:29
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
{Mira dos formas de realizar eso la tuya arreglada y otra]
 
 program mover;
  uses
    crt;
  const
    knesc = #27;
    kbarr = #72;{flecha arriba}
     kabj = #80;{flecha abajo}
     kbiz = #75; {flecha izquierd}
    kdere = #77; {flecha derecha}
 var
  x, y : integer;
  movida, salida : char;
 
 procedure pantalla;
 begin
   textbackground (red); textcolor (yellow);
   clrscr;
   gotoxy(2,1);write('presione esc para salir');
   gotoxy(2,25);write ('use las flechas para moverse');
   window(1,2,80, 40);textbackground(black); textcolor (white);
   clrscr;
 end;
 
 procedure posicion(var x, y : integer);
 begin
    pantalla;
    gotoxy(x,y); write('*');
    gotoxy(x - 1,y);write('*');
  end;
 
 procedure izquierda(var x,y : integer);
 begin
    x := x - 1;
    gotoxy(x,y);write('*');
    gotoxy (x + 1,y);write('*');
 end;
 
 procedure abajo(var x,y : integer);
 begin
   y := y + 1;
   gotoxy(x,y);write('*');
   gotoxy(x + 1,y);write ('*');
 end;
 
 procedure arriba(var x,y : integer);
 begin
    y := y - 1;
    gotoxy(x,y);write('*');
    gotoxy(x + 1,y);write('*');
  end;
 
  procedure derecha(var x,y : integer);
  begin
     x := x + 1;
    gotoxy(x,y);write('*');
    gotoxy(x + 1,y);write('*');
  end;
 
  procedure moveresterisco;
  var
     tecla : char;
     x, y : integer;
  begin
  x := 40;
  y := 12;
  gotoxy(x,y);write('**');
  repeat
    gotoxy(37,11);write('Esc Salir');
    tecla := readkey;
    gotoxy(x,y);write('  ');
  case tecla of
 kbarr : y := y - 1;
  kabj : y := y + 1;
  kbiz : x := x - 1;
 kdere : x := x + 1;
 end;
  if x > 78 then
  x := 78;
  if x < 2 then
  x := 2;
  if y > 24 then
  y := 24;
  if y < 1 then
  y := 1;
  gotoxy(x,y);write('**');
  until tecla = #27;
  end;
 
 begin
  clrscr;
  moveresterisco;
  x := 40;
  y := 12;
  posicion(x,y);
  repeat
  movida := readkey;
  gotoxy(x,y);write(' ');
  gotoxy (x + 1,y);write(' ');
  case movida of
 kbarr : arriba(x,y);
  kabj : abajo(x,y);
  kbiz : izquierda(x,y);
 kdere : derecha(x,y);
 end;
  until movida = knesc;
end.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar