I am trying to do this code to print "YOU HIT THE RED BLOCK!!" but not working
player_hitbox = pygame.draw.rect(win, (255,255,45), player,2)
for tile_object in map.tmxdata.objects:
if tile_object.name == 'player':
x = tile_object.x
y = tile_object.y
if tile_object.name == 'wall':
hit_rect = pygame.Rect(tile_object.x, tile_object.y, tile_object.width, tile_object.height)
# rect = pygame.Rect(tile_object.x, tile_object.y, tile_object.width, tile_object.height)
if player_hitbox.colliderect(hit_rect) == True:
print("YOU HIT THE RED BLOCK!!")