-1

I used PyTMX to help to create a 2d RPG type game in Pygame. The problem I have encountered is that only a certain tile/certain type of tile gets displayed.

What I want the map to look like: http://imgur.com/DpyIVT3

What I get:
http://imgur.com/EJUDetb

My code:

import pygame
import os
from pytmx import load_pygame


pygame.init()
BLACK = [ 0, 0, 0]
WHITE = [255, 255, 255]
os.environ['SDL_VIDEO_CENTERED'] = '1'


SIZE = [500, 500]
screen = pygame.display.set_mode(SIZE)
pygame.display.set_caption("Template")
gameMap = load_pygame("test.tmx")
screen.fill(WHITE)
clock = pygame.time.Clock()


images = []

for y in range(10):
    for x in range(10):
        image = gameMap.get_tile_image(x,y,0)
        images.append(image)

i = 0

for y in range(10):
    for x in range(10):
        screen.blit(images[i],(x * 50, y * 50))
        i += 1

done = False

while done == False:

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            done = True

    pygame.display.flip()
    clock.tick(20)


pygame.quit ()

Any idea why?

Anthon
  • 69,918
  • 32
  • 186
  • 246
NezamiZero
  • 11
  • 4

1 Answers1

0

Okay, the problem was found to be the actual images I used. I went to photoshop and noticed the images that showed up were the ones marked as "Background" in Photoshop, so I took the other images, went to Layer > New > Layer From Background and saved the image as a PNG. works fine now :)

NezamiZero
  • 11
  • 4