Player and action...
This commit is contained in:
parent
b17626b8fa
commit
09ff673b61
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
|
8
main.adb
8
main.adb
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -35,6 +35,10 @@ package player is
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure render;
|
||||
procedure move_up;
|
||||
procedure move_down;
|
||||
procedure move_left;
|
||||
procedure move_right;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user