Browse Source

Player and action...

master
Ognjen Milan Robovic 7 months ago
parent
commit
09ff673b61
5 changed files with 17 additions and 17 deletions
  1. +1
    -8
      action.adb
  2. +1
    -5
      action.ads
  3. +4
    -4
      main.adb
  4. +7
    -0
      player.adb
  5. +4
    -0
      player.ads

+ 1
- 8
action.adb View File

@@ -10,9 +10,7 @@
-- write a new program in Ada, a tiny game. Work in progress, it's messy and ugly for now...
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

with core, screen, player;

use screen;
with core;

package body action is

@@ -32,11 +30,6 @@ package body action is
procedure game_idle is begin null; end game_idle;
procedure game_exit is begin active := false; end game_exit;

procedure move_up is begin player.data.y := player.data.y - 1; end move_up;
procedure move_down is begin player.data.y := player.data.y + 1; end move_down;
procedure move_left is begin player.data.x := player.data.x - 1; end move_left;
procedure move_right is begin player.data.x := player.data.x + 1; end move_right;

------------------------------------------------------------------------------------------

end action;

+ 1
- 5
action.ads View File

@@ -10,7 +10,7 @@
-- write a new program in Ada, a tiny game. Work in progress, it's messy and ugly for now...
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

with core, screen, player;
with core;

package action is

@@ -37,10 +37,6 @@ package action is
procedure unbind (symbol : character := core.CANCEL);

procedure game_exit;
procedure move_up;
procedure move_down;
procedure move_left;
procedure move_right;

------------------------------------------------------------------------------------------



+ 4
- 4
main.adb View File

@@ -237,10 +237,10 @@ begin
------------------------------------------------------------------------------------------

action.bind ('q', action.game_exit'access);
action.bind ('w', action.move_up'access);
action.bind ('s', action.move_down'access);
action.bind ('a', action.move_left'access);
action.bind ('d', action.move_right'access);
action.bind ('w', player.move_up'access);
action.bind ('s', player.move_down'access);
action.bind ('a', player.move_left'access);
action.bind ('d', player.move_right'access);

screen.delete;
screen.offset;


+ 7
- 0
player.adb View File

@@ -12,6 +12,8 @@

with core, screen;

use screen;

package body player is

------------------------------------------------------------------------------------------
@@ -21,6 +23,11 @@ package body player is
screen.render_character ('@', core.colour.cyan, core.effect.bold, screen.height (data.y), screen.width (data.x));
end render;

procedure move_up is begin player.data.y := player.data.y - 1; end move_up;
procedure move_down is begin player.data.y := player.data.y + 1; end move_down;
procedure move_left is begin player.data.x := player.data.x - 1; end move_left;
procedure move_right is begin player.data.x := player.data.x + 1; end move_right;

------------------------------------------------------------------------------------------

end player;

+ 4
- 0
player.ads View File

@@ -35,6 +35,10 @@ package player is
------------------------------------------------------------------------------------------

procedure render;
procedure move_up;
procedure move_down;
procedure move_left;
procedure move_right;

------------------------------------------------------------------------------------------



Loading…
Cancel
Save