From: marstr Date: Tue, 3 Sep 2024 18:02:08 +0000 (+0200) Subject: Adjustment to trees at buildings X-Git-Url: https://marstr.online/code/gitweb.cgi?a=commitdiff_plain;h=5a9f53ba41edf8680b4603d343d2235a3c558dec;p=orthographic Adjustment to trees at buildings --- diff --git a/layergen.py b/layergen.py index 7bc2703..81f2a6d 100644 --- a/layergen.py +++ b/layergen.py @@ -658,6 +658,7 @@ class mstr_layergen: # Add some random trees div = int(self._imgsize/200) + trees = Image.new("RGBA", (self._imgsize, self._imgsize)) for y in range(0, self._imgsize, div): for x in range(0, self._imgsize, div): if x > 0 and x < self._imgsize and y > 0 and y < self._imgsize: @@ -671,11 +672,16 @@ class mstr_layergen: shf_x = randrange(x-11, x+11) shf_y = randrange(y-11, y+11) if shf_x > 0 and shf_x < self._imgsize and shf_y > 0 and shf_y < self._imgsize: - # Pick some file - pick = str(randrange(1, 11)) - tree = Image.open(mstr_datafolder + "Textures\\building\\area\\p" + pick + ".png") - layer_comp.alpha_composite(tree, (shf_x, shf_y)) - #layer_comp.paste(tree, (shf_x, shf_y)) + # Pick a number of trees to place + numtrees = randrange(1, 5) + for i in range(1, numtrees): + # Pick some file + pick = str(randrange(1, 11)) + tree = Image.open(mstr_datafolder + "Textures\\building\\area\\p" + pick + ".png") + trees.alpha_composite(tree, (shf_x, shf_y)) + #layer_comp.paste(tree, (shf_x, shf_y)) + trees.alpha_composite(layer_comp) + layer_comp = trees mstr_msg("layergen", "Layer image generated")