SoloCodigo
		Programación General => Otros Lenguajes de Programación => ADA => Mensaje iniciado por: sistinfo en Sábado 14 de Marzo de 2009, 19:44
		
			
			- 
				bueno pues me presenta un error en la parte de procedure Disparar_Bolitas, si porfavor podrian ayudarme porfavor......  aqui les va todo el codigo.
 
 
 with Ada.Integer_Text_Io;
 use Ada.Integer_Text_Io;
 with Ada.Text_Io;
 use Ada.Text_Io;
 with Adagraph;
 use Adagraph;
 with Ada.Numerics.Elementary_Functions;
 use Ada.Numerics.Elementary_Functions;
 with Ada.Numerics;
 use Ada.Numerics;
 with Ada.Numerics.Float_Random;
 use Ada.Numerics.Float_Random;
 with Ada.Float_Text_Io;
 use Ada.Float_Text_Io;
 procedure Ejecutar_Juego is
 Color : Color_Type;
 Tecla : Character;
 Angulo : Float := 1.57;
 Matriz : array (1 .. 10, 1 .. 7) of Color_Type := (others => (others =>
 Black));
 procedure Animar is
 Tecla : Character;
 Y : Integer := 0;
 X : Integer := 0;
 M : Float := 0.0;
 B : Float := 0.0;
 -- procedure Disparar_Bolitas is
 -- begin
 -- if Key_Hit then
 -- Tecla := Get_Key;
 -- Draw_Circle (Y,X,25,Color,True);
 -- if Tecla = Vk_Up then
 -- M := Tan (Angulo);
 -- B:= Sin (Angulo);
 -- Y :=(Integer(M) * X) +Integer(B) ;
 -- end if;
 -- end if;
 -- end Disparar_Bolitas ;
 begin
 Draw_Line(175,43,Integer(37.0*Cos(Angulo))+175,Integer(37.0*Sin(
 Angulo))+43,Magenta);
 Draw_Circle(Integer(37.0*Cos(Angulo))+175,Integer(37.0*Sin(
 Angulo))+105,25,color,True);
 
 if Key_Hit then
 Tecla := Get_Key;
 Draw_Circle (175,-33,75,Cyan,True);
 
 -- Draw_Circle(Integer(37.0*Cos(Angulo))+175,Integer(37.0*Sin(
 -- Angulo))+105,25,Color,True);
 Put ("ok");
 delay 0.02;
 Draw_Line(175,43,Integer(37.0*Cos(Angulo))+175,Integer(37.0*Sin (
 Angulo))+43,Black);
 Draw_Circle(Integer(37.0*Cos(Angulo))+175,Integer(37.0*Sin(
 Angulo))+105,25,black,True);
 if Tecla=Vk_Right then
 Angulo := Angulo+0.0873 ;
 elsif Tecla=Vk_Left then
 Angulo := Angulo- 0.0873 ;
 end if;
 end if;
 end Animar;
 procedure Comprobar_Trio is
 begin
 for C in 1..5 loop
 for K in 1..5 loop
 if ((Matriz(K,C)= Matriz (K,C+1))and(Matriz(K,C) =Matriz (K,C+
 2)))then
 Put (Color_Type'Image(Matriz(K,C)));
 Put (Color_Type'Image(Matriz(K,C+1)));
 Put (Color_Type'Image(Matriz(K,C+2)));
 New_Line;
 Matriz (K,C) := Black;
 Draw_Circle ((C*50)-25,625-K*50,25,Black,True);
 Matriz (K,C) := Black;
 Draw_Circle (((C+1)*50)-25,625-K*50,25,Black,True);
 Matriz (K,C) := Black;
 Draw_Circle (((C+2)*50)-25,625-K*50,25,Black,True);
 end if ;
 end loop;
 end loop;
 for M in 1..5 loop
 for S in 1..5 loop
 if ((Matriz(S,M)= Matriz (S+1,M))and(Matriz(S,M) =Matriz (S+2,
 M)))then
 Put (Color_Type'Image(Matriz(S,M)));
 Put (Color_Type'Image(Matriz(S+1,M)));
 Put (Color_Type'Image(Matriz(S+2,M)));
 New_Line;
 Matriz (S,M) := Black;
 Draw_Circle ((M*50)-25,625-S*50,25,Black,True);
 Matriz (S,M) := Black;
 Draw_Circle (((M)*50)-25,625-(S+1)*50,25,Black,True);
 Matriz (S,M) := Black;
 Draw_Circle ((M*50)-25,625-(S+2)*50,25,Black,True);
 end if ;
 end loop;
 end loop;
 end Comprobar_Trio;
 procedure Graficar is
 Color : Color_Type;
 --graficar
 begin
 
 Draw_Line(175,43,175,80,Magenta);
 draw_circle(175,105,25,color,true);
 for J in 1..5 loop -- filas
 for I in 1..7 loop -- columnas
 loop
 Color := Random_Color;
 exit when Color /= Black;
 end loop;
 Matriz (J,I) := Color;
 Draw_Circle ((I*50)-25,625-J*50,25,Color,True);
 end loop;
 end loop;
 Draw_Circle (175,-33,75,Cyan,True);
 
 
 end Graficar;
 procedure Jugar is
 --procedure_jugar
 begin
 Clear_Window (Black);
 Graficar;
 loop
 Animar;
 -- Alternar_Bolitas;
 Comprobar_Trio;
 exit when False;-- Matriz(J,I) = White;
 end loop;
 Clear_Window (Black);
 end Jugar;
 procedure Instrucciones is
 Tecla : Character;
 --Procedimiento instrucciones
 begin
 loop
 Display_Text(12,490,
 "blablablalblalblablalblalblalblalblalblalbla", White);
 Tecla:=Get_Key;
 exit when (Tecla='x');
 end loop;
 end Instrucciones;
 procedure Mostrar_Menu is
 X : Integer;
 Y : Integer;
 C : Character;
 --mostrar menu
 begin
 Clear_Window (black);
 loop
 Draw_Box(190,170,345,100, Yellow,False);
 Display_Text(200,150, "1.- Jugar",White);
 Display_Text(200,130, "2.- Instrucciones", White);
 Display_Text(200,110, "3.- Salir",White);
 Tecla:= Get_Key;
 if Tecla = '1' then
 null;
 Jugar;
 elsif Tecla='2' then
 Instrucciones;
 end if;
 exit when (Tecla='3');
 Put(Tecla);
 end loop;
 -- delay 5.0;
 end Mostrar_Menu;
 --procedure_ejecutar_juego
 begin
 Open_Graph_Window (
 X_Size => 350,
 Y_Size => 600);
 Mostrar_Menu;
 end Ejecutar_Juego;