diff options
| author | Charles <sircharlesaze@gmail.com> | 2019-12-08 11:06:26 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2019-12-08 11:06:26 +0100 |
| commit | 4b367c25b0365be8fe38381136353a659d5ce545 (patch) | |
| tree | 8e92a5948c67a58f1fb4ce27f2a73286ed57ed1c /game.ads | |
| parent | 22e73779f55b051d34fc0490fbb55045f3f321d9 (diff) | |
| download | snake-4b367c25b0365be8fe38381136353a659d5ce545.tar.gz snake-4b367c25b0365be8fe38381136353a659d5ce545.tar.bz2 snake-4b367c25b0365be8fe38381136353a659d5ce545.zip | |
Added direction change with arrow key, food spawn
Diffstat (limited to 'game.ads')
| -rw-r--r-- | game.ads | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -1,3 +1,5 @@ +with Ada.Numerics.Discrete_Random; + with Queue; package Game is @@ -17,18 +19,30 @@ package Game is DIRECTION_RIGHT ); + subtype T_Width_Random_Range is Positive range 1..10; + subtype T_Height_Random_Range is Positive range 1..10; + package P_Width_Random is new Ada.Numerics.Discrete_Random(T_Width_Random_Range); + package P_Height_Random is new Ada.Numerics.Discrete_Random(T_Height_Random_Range); + use P_Width_Random; + use P_Height_Random; + type T_Game is record height: Positive; width: Positive; snake: T_Queue; direction: T_Direction; food: T_Position; + width_generator: P_Width_Random.Generator; + height_generator: P_Height_Random.Generator; + end record; procedure Init(game: out T_Game; width: Positive; height: Positive); function Next(game: in out T_Game) return Boolean; + procedure Change_Direction(game: in out T_Game; + direction: T_Direction); private |
