Преглед изворни кода

Extended landmarks collision to be any size, aka landmark sprite dependent.

master
Ognjen Milan Robovic пре 1 недеља
родитељ
комит
58598f03c0
3 измењених фајлова са 15 додато и 6 уклоњено
  1. +12
    -4
      source/world.adb
  2. +3
    -2
      source/world.ads
  3. BIN
      sprite/world/landmark/pine_forest.png

+ 12
- 4
source/world.adb Прегледај датотеку

@@ -53,12 +53,20 @@ package body world is
end loop;
--
for index in 1 .. landmark_limit loop
map.landmarks (index).index := core.random (0, 8);
map.landmarks (index).x := core.random (0, map.width - 1);
map.landmarks (index).y := core.random (0, map.height - 1);
map.landmarks (index).index := core.random (0, 9);
map.landmarks (index).x := core.random (6, map.width - 6);
map.landmarks (index).y := core.random (6, map.height - 6);
--
if trait (landmark_index'val (map.landmarks (index).index)).clip then
map.clips (map.landmarks (index).x, map.landmarks (index).y) := true;
declare reach_x : constant natural := landmarks (landmark_index'val (map.landmarks (index).index)).width / core.base;
reach_y : constant natural := landmarks (landmark_index'val (map.landmarks (index).index)).height / core.base;
begin
for x in 0 .. reach_x - 1 loop
for y in 0 .. reach_y - 1 loop
map.clips (map.landmarks (index).x + x, map.landmarks (index).y + y) := true;
end loop;
end loop;
end;
end if;
end loop;
--


+ 3
- 2
source/world.ads Прегледај датотеку

@@ -15,8 +15,8 @@ package world is
------------------------------------------------------------------------------------------

type landmark_index is (
dead_tree, mossy_rock, palm_tree, pine_tree, reeds, rock,
snowed_pine_tree, snowed_rock, spiky_rock
dead_tree, mossy_rock, palm_tree, pine_tree, pine_forest, reeds,
rock, snowed_pine_tree, snowed_rock, spiky_rock
);

type landmark_trait is record
@@ -59,6 +59,7 @@ package world is
mossy_rock => (swamp, true, 1),
palm_tree => (sand, true, 4),
pine_tree => (grass, true, 4),
pine_forest => (grass, true, 4),
reeds => (swamp, false, 4),
rock => (sand, true, 1),
snowed_pine_tree => (snow, true, 4),


BIN
sprite/world/landmark/pine_forest.png Прегледај датотеку

Before After
Width: 192  |  Height: 32  |  Size: 2.0KB

Loading…
Откажи
Сачувај