Experimental minimal terminal rogue-like game in Ada programming language. I used to write a lot of Ada programs some time ago, then went in full C and assembly mode, and came back to Ada...
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

48 lignes
2.5KB

  1. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  2. -- Copyright (c) 2023 - Ognjen 'xolatile' Milan Robovic
  3. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  4. -- Xabina is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either
  5. -- version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
  6. -- implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  7. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  8. with core, map;
  9. package body ammunition is
  10. ------------------------------------------------------------------------------------------
  11. procedure generate is
  12. y : natural := 0;
  13. x : natural := 0;
  14. identifier : natural := 0;
  15. begin
  16. for this in map.mark
  17. loop
  18. y := core.randomize (0, natural (map.height'last));
  19. x := core.randomize (0, natural (map.width'last));
  20. identifier := core.randomize (0, natural (list'size));
  21. map.variable_data (this) := (integer (y), integer (x), core.ammunition, identifier);
  22. end loop;
  23. end generate;
  24. procedure render is
  25. symbol : character := ' ';
  26. colour : character := core.colour.white;
  27. effect : character := core.effect.normal;
  28. begin
  29. for this in map.mark
  30. loop
  31. symbol := constant_data (list'val (map.variable_data (this).identifier)).symbol;
  32. colour := constant_data (list'val (map.variable_data (this).identifier)).colour;
  33. effect := constant_data (list'val (map.variable_data (this).identifier)).effect;
  34. core.render_character (symbol, colour, effect, core.screen_height (map.variable_data (this).y), core.screen_width (map.variable_data (this).x));
  35. end loop;
  36. end render;
  37. ------------------------------------------------------------------------------------------
  38. ------------------------------------------------------------------------------------------
  39. end ammunition;