Level Editor / Map Maker | Python Pygame | Game Dev
Описание
In this video, I'll show you how to make a level editor for pygame.
You'll be able to design a game level in paint and convert it as a level in your python game.
#mapmaker #pygame #python
Please leave a LIKE and SUBSCRIBE for more content!
https://www.youtube.com/channel/UCE_Q2KfZFP4jqy4bw2EOEiw?sub_confirmation=1
Code:
level1 = list(imread('img.png', 1))#the image
for i in range(len(level1)):#foreach rows of pixels in the image
for j in range(len(level1[i])):#foreach pixel in the row
blue = list(level1[i][j])[0]
green = list(level1[i][j])[1]
red = list(level1[i][j])[2]
if blue == 255 and green == 255 and red == 255:
display.blit(dirt_img,(j*10,i*10))
elif blue == 0 and green == 255 and red == 0:
pass
else:
pass
#pygame.draw.rect(display, (10, 150, 200), pygame.Rect(j*10, i*10, 32, 32))
Рекомендуемые видео


















