Parcourir la source

Added map revealing thing...

master
Ognjen Milan Robovic il y a 1 semaine
Parent
révision
e73d65ec9a
3 fichiers modifiés avec 24 ajouts et 2 suppressions
  1. +1
    -1
      source/main.adb
  2. +23
    -1
      source/world.adb
  3. BIN
      sprite/dark.png

+ 1
- 1
source/main.adb Voir le fichier

@@ -105,7 +105,7 @@ procedure main is

procedure introduction is
begin
ui.write ("Heyo world!", 0, 0);
ui.write ("[-- Please press Spacebar to continue]", 0, 0);
end introduction;

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


+ 23
- 1
source/world.adb Voir le fichier

@@ -8,11 +8,16 @@ package body world is

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

dark : core.sprite;

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

procedure configure is
begin
core.echo (core.comment, "Configuring world components...");
--
tiles := core.import_sprite ("./sprite/world/terrain/terrain.png", 1, 1);
dark := core.import_sprite ("./sprite/dark.png", 1, 1);
--
for index in landmark_index loop
declare file : constant string := core.lowercase (index'image);
@@ -121,7 +126,7 @@ package body world is
--
core.draw (data => tiles,
x => offset.x + (horizontal - core.camera.x) * core.base * core.zoom,
y => offset.y + (vertical - core.camera.y) * core.base * core.zoom,
y => offset.y + (vertical - core.camera.y) * core.base * core.zoom,
u => u,
v => v,
width => core.base,
@@ -163,6 +168,23 @@ package body world is
offset.y + (map.items (index).y - core.camera.y) * core.base * core.zoom);
end if;
end loop;
--
for vertical in 0 .. map.height - 1 loop
exit when offset.y + (vertical - core.camera.y) * core.base * core.zoom > core.window_height;
--
for horizontal in 0 .. map.width - 1 loop
exit when offset.x + (horizontal - core.camera.x) * core.base * core.zoom > core.window_width;
--
if not (horizontal > core.camera.x - 6
and horizontal < core.camera.x + 6
and vertical > core.camera.y - 6
and vertical < core.camera.y + 6) then
core.draw (data => dark,
x => offset.x + (horizontal - core.camera.x) * core.base * core.zoom,
y => offset.y + (vertical - core.camera.y) * core.base * core.zoom);
end if;
end loop;
end loop;
end draw;

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


BIN
sprite/dark.png Voir le fichier

Avant Après
Largeur: 32  |  Hauteur: 32  |  Taille: 122B Largeur: 16  |  Hauteur: 16  |  Taille: 107B

Chargement…
Annuler
Enregistrer