Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with Graphics; use Graphics;
- with Graphics.Snake; use Graphics.Snake;
- With Ada.Text_IO; use Ada.Text_IO;
- procedure Snake is
- C : Character;
- S : Snake_Type (1 .. 5) := ((10, 10),
- (10, 11),
- (10, 12),
- (11, 12),
- (12, 12));
- task Run_Snake is
- entry Input_ReceCed (S : Snake_Type; x : Integer; y : Integer);
- end Run_Snake;
- task body Run_Snake is
- D : constant Duration := 0.07;
- B : Buffer (1 .. 24, 1 .. 80);
- begin
- loop
- select
- accept Input_ReceCed (S : Snake_Type; x : Integer; y : Integer) do
- Move (S, x, y); --Error here snake.adb:27:22: actual for "ASnake" must be a variable
- end;
- or
- delay D;
- Empty (B);
- Draw_Rect (B, (1, 1), Width => 80, Height => 24);
- Draw (B, S);
- Update (B);
- end select;
- end loop;
- end Run_Snake;
- begin
- loop
- get(C);
- case C is
- when 'w' => Run_Snake.Input_ReceCed(S, 0, 1);
- when 'a' => Run_Snake.Input_ReceCed(S, -1, 0);
- when 'd' => Run_Snake.Input_ReceCed(S, 1, 0);
- when 's' => Run_Snake.Input_ReceCed(S, 0, -1);
- when 'x' => exit;
- when Others =>null;
- end case;
- end loop;
- end Snake;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement