random Rotation code improvement

if elif improvement
pull/1/head
Horst JENS 2021-08-14 02:46:43 +07:00 committed by GitHub
parent e9f383e4c5
commit 46b1ff593a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 5 deletions

@ -58,13 +58,15 @@ func generate():
var _quaternion = Quat(Vector3(0, 1, 0), deg2rad(rand_range(0, 180)))
var _randomRotation = Basis(_quaternion).get_orthogonal_index()
if _tile == 0 and _random < 2:
set_tile(Vector3(x + offset, _noise, y), 0, _randomRotation)
if _tile == 0:
if _random < 1:
set_tile(Vector3(x + offset, _noise, y), 2, _randomRotation)
if _tile == 0 and _random < 1:
set_tile(Vector3(x + offset, _noise, y), 2, _randomRotation)
elif _random < 2:
set_tile(Vector3(x + offset, _noise, y), 0, _randomRotation)
if _tile > 1 and _random < 1:
elif _tile > 1 and _random < 1:
set_tile(Vector3(x + offset, _noise, y), 1, _randomRotation)
# Set terrain tile