I get a pygame error for 'pygame.mixer.music.play'

76 views Asked by At

I get this error and I don't know why. I am using Visual Studio Code:

pygame.mixer.music.play(loops=-1, start=0.0, fade_ms=4000) TypeError: function takes at most 2 keyword arguments (3 given)

I have this code in a part of my game:

pygame.mixer.music.load(os.path.join("assets", "game_music.wav"))
pygame.mixer.music.play(loops=-1, start=0.0, fade_ms=4000)
pygame.mixer.music.set_volume(0.3)

I also have:

import pygame
import os
from pygame import mixer

pygame.mixer.pre_init(44100, -16, 2, 512)
mixer.init()
pygame.init()

I want to have all 3 arguments. It should work according to https://www.pygame.org/docs/ref/music.html#pygame.mixer.music.play Can someone help me please?

0

There are 0 answers