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!
/ @codenull3755
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))
On this page of the site you can watch the video online Level Editor / Map Maker | Python Pygame | Game Dev with a duration of hours minute second in good quality, which was uploaded by the user codeNULL 01 July 2020, share the link with friends and acquaintances, this video has already been watched 2,498 times on youtube and it was liked by 50 viewers. Enjoy your viewing!