xhads/source/unit.adb

41 lines
1.4 KiB
Ada
Raw Normal View History

2024-02-15 21:03:09 -05:00
with core, effect, faction, unit;
use unit;
package body unit is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
type sprite_array is array (codex) of core.sprite;
sprite : sprite_array;
2024-02-24 14:51:53 -05:00
--~icon : sprite_array;
2024-02-15 21:03:09 -05:00
------------------------------------------------------------------------------------------
procedure configure is
begin
2024-03-11 08:42:25 -04:00
core.echo (core.comment, "Configuring unit components...");
--
2024-02-15 21:03:09 -05:00
for index in codex
loop
declare
folder : constant string := core.lowercase (faction.codex'image (trait (index).kind));
file : constant string := core.lowercase (codex'image (index));
begin
sprite (index) := core.load_sprite ("./sprite/unit/" & folder & "/" & file & ".png", 6, 6);
2024-02-15 21:03:09 -05:00
end;
end loop;
end configure;
------------------------------------------------------------------------------------------
procedure draw (index : in codex; state : in animation; x, y : in integer) is
begin
core.move (sprite (index), x, y, 6, animation'pos (state));
end draw;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
end unit;