를 생성하는 방법 펄린에서 소음을 pygame?

0

질문

원하는 만큼 오랫동안 생존 게임에 문제가 있으 펄린 소음. 내 프로그램으로 제공하 나이:

enter image description here

하지만 내가 뭔가를 원하는 같은 섬이나 강이 있습니다.

여기 나의 코드:

#SetUp#
import pygame, sys, random
pygame.init()
win = pygame.display.set_mode((800, 600))
pygame.display.set_caption('Isom')
x = 0
y = 0
s = 0
tilel = list()
random.seed(5843)
MAP = [random.randint(0, 1) for _ in range(192)]

#Tiles#
class tile():
    grass = pygame.image.load('Sprites/Images/Grass.png')
    water = pygame.image.load('Sprites/Images/Water.png')

#Loop#
while True:
    for key in pygame.event.get():
        if key.type == pygame.QUIT:
            pygame.quit()
            sys.exit()
    #World#
    for a in range(12):
        for b in range(16):
            if MAP[s] == 0:
                win.blit((tile.grass), (x, y))
            elif MAP[s] == 1:
                win.blit((tile.water), (x, y))
            x += 50
            s += 1
        x = 0
        y += 50
    x = 0
    y = 0
    s = 0
    #Update#
    pygame.display.update()
perlin-noise pygame python
2021-11-23 16:52:32
2

최고의 응답

0

내가 설치하는 것이 좋습니다 noise 패키지입니다.
다음 사용 noise.pnoise1(x) 1 차원 펄린 소음, noise.pnoise2(x, y) 2 차원 펄린 소음, noise.pnoise3(x, y, z) 에 대한 3 차원 펄린 소음.

2021-11-24 16:33:42
0

첫째,중요한 사고:펄린 인간이지만 실제"펄린"의 소음 알고리즘은 오래된 광장과 눈에 띄게 정렬되어 있습니다. 더 나은,일반적으로 사용하는 단순한 형 소음.

내 건 PyFastNoiseLite: https://github.com/tizilogic/PyFastNoiseLite 에 따라 설치 지침,그 거울은 C++예 FastNoiseLite 문서 여기: https://github.com/Auburn/FastNoiseLite/tree/master/Cpp 에 주의해야 합 내부 주파수의 곱셈할 수 있는 변화 SetFrequency(f)

또한 사용할 수 있는 파이썬 소음 라이브러리에 대한 단순한 형 noise,소음 snoise2(x, y) 하지만 사용 하고자 하는 경우 snoise3(x, y, z) 내가 첫째로 고려할 정보를 원하시면 여기: https://www.reddit.com/r/proceduralgeneration/comments/qr6snt/countdown_timer_simplex_patent_expiration/

2021-11-24 20:37:26

다른 언어로

이 페이지는 다른 언어로되어 있습니다

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................