I’m trying to display a map in tmx format

I’m still having issues displaying a tmx map into python, I have a code that can display it onto a game, but I want to do it so I can display the map into another game. The code I used tto try all of this was made by KidsCanCode on Youtube : https://www.youtube.com/watch?v=QIXyj3WeyZM
I can’t manage to transfer this type of code to our project, which is this one :
“screen”

import pygame
class Screen:
    
    def __init__(self,width,height):
        self.width=width
        self.height=height
        pygame.display.set_caption("balls")
        self.ecran=pygame.display.set_mode((width,height))
               
    def refresh(self):
        pygame.display.flip()
        
    def clear(self):
        self.ecran.fill((0,0,0))
    
    def update(self):
        self.clear()
        self.refresh()
        
    def draw_rect(self,x,y,color):
        return pygame.draw.rect(self.ecran,color,(x,y,20,20))
    
    def draw_attack(self,x,y,color):
        return pygame.draw.rect(self.ecran,color,(x-100,y-100,200,200),1)
    
    # a supprimer_plus_tard c'est pour t'aider
    def draw_aggro(self,x,y,color):
        pygame.draw.circle(self.ecran,color,(x+10,y+10),150,1)
        
        
    def draw_dash(self,x,y,direction,color):
        if direction=='d':
            return pygame.draw.rect(self.ecran,color,(x+80,y,20,20))
        if direction=='g':
            return pygame.draw.rect(self.ecran,color,(x-80,y,20,20))
        if direction=='h':
            return pygame.draw.rect(self.ecran,color,(x,y-80,20,20))
        if direction=='b':
            return pygame.draw.rect(self.ecran,color,(x,y+80,20,20))
        
    

“joueur”

import pygame

from screen import *

class Player:
    
    def __init__(self,x,y,screen):
        self.hp=20
        self.stats={'hp':20, 'attack':10, 'defense':10, 'crit_rate' :10, 'crit_damage':1.5, 'accuracy':1}
        self.x=x
        self.y=y
        self.invi=False
        self.cd=0
        self.spend=0
        self.player=screen.draw_rect(self.x,self.y,'grey')
        self.atck=None
        self.dir='d'
        
    def en_vie(self):
        if self.hp>0:
            return True
        return False
    
    def start_invis(self):
        self.invi=True
        self.spend=0
    
    def add_invis(self,spent):
        self.spend+=spent
        
    def check_invis(self):
        if self.spend>=15:
            self.spend=0
            self.invi=False
            return True
        return False
        
    def degats_recu(self,damage):
        if self.check_invis()==False:
            return None
        else:
            if self.hp>damage:
                self.start_invis()
                self.hp-=damage
            else:
                self.hp=0
    
    def move(self,largeur,hauteur,screen,event):
        if event.key==pygame.K_RIGHT:
            if self.x+30<=largeur:
                self.x+=10
                self.dir='d'
        elif event.key==pygame.K_LEFT:
            if self.x-10>=0:
                self.x-=10
                self.dir='g'
        elif event.key==pygame.K_UP:
            if self.y-10>=0:
                self.y-=10
                self.dir='h'
        elif event.key==pygame.K_DOWN:
            if self.y+30<=hauteur:
                self.y+=10
                self.dir='b'
        if self.invi==True:
            self.player=screen.draw_rect(self.x,self.y,(255, 196, 99))
        else:
            self.player=screen.draw_rect(self.x,self.y,'grey')
    
    def cd_start_dash(self):
        self.cd_dash=0
        
    def cd_add(self,add):
        self.cd_dash+=add
    
    def cd_dash(self):
        if self.cd_dash<3000:
            return False
        else:
            self.cd_dash=0
            return True
    
    def dash(self,largeur,hauteur,screen):
        if self.dir=='d':
            if self.x+100<=largeur:
                self.x+=80
        elif self.dir=='g':
            if self.x-80>=0:
                self.x-=80
        elif self.dir=='h':
            if self.y-80>=0:
                self.y-=80
        elif self.dir=='b':
            if self.y+100<=hauteur:
                self.y+=80
        if self.invi==True:
            self.player=screen.draw_dash(self.x,self.y,self.dir,(255, 196, 99))
        else:
            self.player=screen.draw_dash(self.x,self.y,self.dir,'grey')
        

        
    
    def afficher_joueur(self,screen):
        if self.invi==True:
            self.player=screen.draw_rect(self.x,self.y,(255, 196, 99))
        else:
            self.player=screen.draw_rect(self.x,self.y,'grey')
            
    def attack(self,screen):
        self.atck=screen.draw_attack(self.x,self.y,'green')
        
    def affiche_attack(self,screen):
        self.atck=screen.draw_attack(self.x,self.y,'green')
    
    def get_coords(self):
        return (self.x,self.y)
       
    def get_hp(self):
        return self.hp

“health_bar”

from screen import *
import pygame,sys

class Health:
    
    def __init__(self,hp_max,hp,screen):
        self.hp_max=hp_max
        self.current_hp=hp
        self.width=150
        self.height=35
        self.hp_bar=pygame.Surface((self.width,self.height))
        self.back=pygame.Surface((160,45))
    
    def draw_bar(self,screen):
        screen.ecran.blit(self.hp_bar,(20,20))
        self.hp_bar.fill('black')
        ratio=self.ratio_hp()
        coord=(0,0,self.width*ratio,self.height)
        self.hp_bar.fill('red',coord)
    
    def bar_death(self,screen):
        screen.ecran.blit(self.hp_bar,(20,20))
        self.hp_bar.fill('black')
        screen.refresh()
    
    def update_hp(self,new_hp):
        self.current_hp=new_hp   
    
    def ratio_hp(self):
        return (self.current_hp/self.hp_max)
    
    def background(self,screen):
        screen.ecran.blit(self.back,(15,15))
        self.back.fill('white')
    

“ennemy”

import pygame,random
from screen import *
from joueur import *
from math import sqrt

class Ennemi:
    
    def __init__(self,x,y,screen):
        self.hp=10
        self.y=x
        self.x=y
        self.mob=screen.draw_rect(self.x,self.y,'blue')
        self.atck=screen.draw_attack(self.x,self.y,'green')
    
    def degats_recu(self,damage):
        if self.hp>damage:
            self.hp-=damage
            return None
        self.hp=0
        return None
    
    def distance(self,x0,y0,x1,y1):
        return sqrt((x0-x1)**2+(y0-y1)**2)
    
    def alive(self):
        if self.hp>0:
            return True
        return False
    
    def afficher_mob(self,screen):
        if self.alive():
            self.mob=screen.draw_rect(self.x,self.y,'blue')
            #screen.draw_aggro(self.x,self.y,'red')
        else:
            self.mob=screen.draw_rect(self.x,self.y,'pink')
    
    def roam(self,largeur,hauteur,screen):
        if self.alive():
            choix=random.randint(0,75)
            if choix==0:
                if self.x+30<=largeur:
                    self.x+=10
            elif choix==1:
                if self.x-10>=0:
                    self.x-=10
            elif choix==2:
                if self.y-10>=0:
                    self.y-=10
            elif choix==3:
                if self.y+30<=hauteur:
                    self.y+=10
            self.mob=screen.draw_rect(self.x,self.y,'blue')
        
        
    def get_coords(self):
        return (self.x,self.y)
    
    def player_inrange(self,player):
        coords=player.get_coords()
        if self.distance(self.x,self.y,coords[0],coords[1])<150:
            return True
    
    def player_inrange_attack(self,player):
        coords=player.get_coords()
        if self.distance(self.x,self.y,coords[0],coords[1])<100:
            return True
    
    def attack(self,screen):
        if self.alive():
            self.atck=screen.draw_attack(self.x,self.y,'green')
        else:
            self.atck=None
    
    def aggro_player(self,player,largeur,hauteur,screen):
        if self.alive():
            coords=player.get_coords()
            x,y=coords[0],coords[1]
            if self.x<x:
                if self.x+30<=largeur:
                    self.x+=0.5
            elif self.x>x:
                if self.x-10>=0:
                    self.x-=0.5
            if self.y>y:
                if self.y-10>=0:
                    self.y-=0.5
            elif self.y<y:
                if self.y+30<=hauteur:
                    self.y+=0.5
            self.mob=screen.draw_rect(self.x,self.y,'blue')
        
        

“main”

import pygame,sys,time
from joueur import *
from screen import *
from ennemy import *
from health_bar import *

ecran=Screen(1280,720)
player=Player(ecran.width//2,ecran.height//2,ecran)
mob_1=Ennemi(100,100,ecran)
mob_2=Ennemi(100,1180,ecran)
liste_mob=[mob_1,mob_2]
hp_bar=Health(player.stats['hp'],player.hp,ecran)
class Game:
    
    def __init__(self,width,height):
        pygame.init()
        self.width=width
        self.height=height
        self.clock=pygame.time.Clock()
        
    def overlap_player_mob(self,mob):
        if mob.alive():    
            if player.player.colliderect(mob.mob):
                if player.check_invis()==True:
                    self.degats(5)
    
    def overlap_attack(self,mob):
        if mob.atck:
            if player.player.colliderect(mob.atck):
                if player.check_invis()==True:
                    self.degats(5)
                
    
    def attack_overlapmob(self,mob):
        if player.atck:
            if mob.mob.colliderect(player.atck):
                self.degats_mob(5,mob)
                
                
    
    def degats(self,damage):
        player.degats_recu(damage)
        hp_bar.update_hp(player.hp)
    
    def degats_mob(self,damage,mob):
        mob.degats_recu(damage)
    
    def fin_jeu(self):
        ecran.clear()
        police=pygame.font.Font('Font/Minecrafter.ttf',120)
        texte=police.render('Game over',1,(255,0,0))
        ecran.ecran.blit(texte,(240,320))
        ecran.refresh()
        
    def jeu(self):
        start=time.time()
        self.clock.tick(0)
        pygame.key.set_repeat(15)
        while player.en_vie():
            ecran.clear()
            hp_bar.background(ecran)
            hp_bar.draw_bar(ecran)
            for event in pygame.event.get():
                if event.type==pygame.KEYDOWN:
                    if event.key==pygame.K_ESCAPE:
                        pygame.quit()
                        sys.exit()
                    if event.key==pygame.K_x:
                        player.attack(ecran)
                    if event.key==pygame.K_c:
                        if player.cd_dash():
                            player.dash(self.width,self.height,ecran)
                            player.cd_start()
                    else:
                        player.move(self.width,self.height,ecran,event)
            for mob in liste_mob:
                mob.afficher_mob(ecran)
                if player.atck:
                    self.attack_overlapmob(mob)
                if not mob.player_inrange(player):
                    mob.roam(self.width,self.height,ecran)
                else:
                    mob.aggro_player(player,self.width,self.height,ecran)
                    if mob.player_inrange_attack(player):
                        mob.attack(ecran)
                        self.overlap_attack(mob)
                    self.overlap_player_mob(mob)
            player.afficher_joueur(ecran)
            end=time.time()
            player.add_invis(end-start)
            player.cd_add(end-start)
            ecran.refresh()
        self.fin_jeu()
            
    
gaming=Game(ecran.width,ecran.height)
ecran.refresh()
gaming.jeu()

I tried a lot of ways to display the map, none of them works for this project.. I managed to display my own map onto KidsCanCode’s project, but that wasn’t hard, here I’m stuck and I can’t manage to find any help..

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật