Added states to locations...

This commit is contained in:
Ognjen Milan Robovic 2024-05-19 12:29:15 -04:00
parent 753b35b60d
commit 3af6733ebe
6 changed files with 23 additions and 8 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -219,7 +219,7 @@ begin
world.make (world.swamp, 240, 180);
world.add_chad (player, (0, 0, 0));
world.add_chad (player, (0, 0, 0, 0));
dash;
echo (success, "Successfully initialized game data, entering main gameplay loop.");

View File

@ -113,6 +113,7 @@ package body world is
--
for index in 1 .. landmark_limit loop
map.landmarks (index).index := core.random (0, landmark_count - 1);
map.landmarks (index).state := 0;
map.landmarks (index).x := core.random (6, map.width - 6);
map.landmarks (index).y := core.random (6, map.height - 6);
--
@ -131,6 +132,7 @@ package body world is
--
for index in 1 .. location_limit loop
map.locations (index).index := core.random (0, location_count - 1);
map.locations (index).state := 0;
map.locations (index).x := core.random (6, map.width - 6);
map.locations (index).y := core.random (6, map.height - 6);
--
@ -149,6 +151,7 @@ package body world is
--
for index in 1 .. construction_limit loop
map.constructions (index).index := core.random (0, construction.count - 1);
map.constructions (index).state := 0;
map.constructions (index).x := core.random (6, map.width - 6);
map.constructions (index).y := core.random (6, map.height - 6);
--
@ -165,12 +168,14 @@ package body world is
--
for index in 1 .. equipment_limit loop
map.equipments (index).index := core.random (0, equipment.count - 1);
map.equipments (index).state := 0;
map.equipments (index).x := core.random (0, map.width - 1);
map.equipments (index).y := core.random (0, map.height - 1);
end loop;
--
for index in 1 .. unit_limit loop
map.units (index).index := core.random (0, unit.count - 1);
map.units (index).state := 0;
map.units (index).x := core.random (0, map.width - 1);
map.units (index).y := core.random (0, map.height - 1);
--
@ -271,9 +276,12 @@ package body world is
--
for index in 1 .. location_limit loop
if map.views (map.locations (index).x, map.locations (index).y) then
core.draw (data => locations (location_index'val (map.locations (index).index)),
x => offset.x + (map.locations (index).x - core.camera.x) * core.base * core.zoom,
y => offset.y + (map.locations (index).y - core.camera.y) * core.base * core.zoom);
core.draw (data => locations (location_index'val (map.locations (index).index)),
x => offset.x + (map.locations (index).x - core.camera.x) * core.base * core.zoom,
y => offset.y + (map.locations (index).y - core.camera.y) * core.base * core.zoom,
v => locations (location_index'val (map.locations (index).index)).height * map.locations (index).state,
width => locations (location_index'val (map.locations (index).index)).width,
height => locations (location_index'val (map.locations (index).index)).height);
if core.cursor_inside (x => offset.x + (map.locations (index).x - core.camera.x) * core.base * core.zoom,
y => offset.y + (map.locations (index).y - core.camera.y) * core.base * core.zoom,
width => locations (location_index'val (map.locations (index).index)).width,
@ -284,14 +292,20 @@ package body world is
end if;
end if;
--
if map.locations (index).state = 1 and core.animation_time = 0 then
map.locations (index).state := 2;
end if;
--
if core.camera.x > map.locations (index).x - 2
and core.camera.x < map.locations (index).x + 1 + locations (location_index'val (map.locations (index).index)).width / core.base
and core.camera.y > map.locations (index).y - 2
and core.camera.y < map.locations (index).y + 1 + locations (location_index'val (map.locations (index).index)).height / core.base
and map.locations (index).state = 0
and core.signal_code'pos (core.signal_mode) = core.signal_code'pos (core.signal_e)
and not ui.prioritize then
core.echo (core.warning, "Applying effect...");
effect.apply (location_trait (location_index'val (map.locations (index).index)).evoke);
--
map.locations (index).state := 1;
end if;
end loop;
--

View File

@ -42,6 +42,7 @@ package world is
type entity_trait is record
index : natural;
state : natural;
x, y : integer;
end record;
@ -105,9 +106,9 @@ package world is
);
location_trait : constant array (location_index) of location_stats := (
well_of_agility => ("Well of Agility ", true, 4, 1, (effect.player_add, effect.attribute_speed, 2, false, 0)),
well_of_knowledge => ("Well of Knowledge ", true, 4, 1, (effect.player_add, effect.attribute_wisdom, 2, false, 0)),
well_of_strength => ("Well of Strength ", true, 4, 1, (effect.player_add, effect.attribute_offense, 2, false, 0))
well_of_agility => ("Well of Agility ", true, 4, 3, (effect.player_add, effect.attribute_speed, 2, false, 0)),
well_of_knowledge => ("Well of Knowledge ", true, 4, 3, (effect.player_add, effect.attribute_wisdom, 2, false, 0)),
well_of_strength => ("Well of Strength ", true, 4, 3, (effect.player_add, effect.attribute_offense, 2, false, 0))
);
map : information;