I was wondering if I could draw an image using a list of ones and zeros where a 1 would mean
pygame.draw.rect(DISPLAY_SURF,(0,0,0), (0,0,10,10))
and 0 would mean a space. it would look something like this:
blockMap = [
[0,1,1,0,0,0,1,1,0],
[0,1,1,0,0,0,1,1,0],
[0,0,0,0,0,0,0,0,0],
[1,0,0,0,0,0,0,0,1],
[0,1,1,1,1,1,1,1,0],
[0,0,0,0,0,0,0,0,0]]
I've not tried I lot because I have looked all over the internet unsuccessfully and obviously could not assign an integer to a string.
blockMap = [
[0,1,1,0,0,0,1,1,0],
[0,1,1,0,0,0,1,1,0],
[0,0,0,0,0,0,0,0,0],
[1,0,0,0,0,0,0,0,1],
[0,1,1,1,1,1,1,1,0],
[0,0,0,0,0,0,0,0,0]]
in blockMap if 1:
pygame.draw.rect(DISPLAY_SURF, (0,0,0), (0,0,10,10))
else:
pygame.draw.rect(DISPLAY_SURF, ((BG_COLOUR)), (0,0,10,10))
This should be displaying a smiley face in black against a white background but definitely is not. I know this is totally wrong, I've been trying for ages and that was just a very desperate attempt that I was just hoping to work.