help music

my_music = audio.playMusic(musica)
if com_musica:
    musica = "theme"
elif not com_musica:
    musica = ""
    my_music.stop(musica)

(complete code)

import time from math import floor def checkInput(obj,val): if hasattr(obj,val): return obj[val] != 0 return 0

def init(): global com_musica,musica global geral, map_num, passando, dano, morte, paraquedas, vida global mapa, tempo, displayed, landed, facing, sprite, hero_x, hero_y, vx, vy

passando = False
facing = 1
map_num = 1
morte = False
vida = 5
touchKeys["arrows"] = not system.inputs.keyboard
sprite = "sprite"
hero_x = -200
hero_y = -100
vx = 0
vy = 0
displayed = []
mapa = "map1"
tempo = time.time()
dano = False
geral = 1

com_musica = True
musica = ""

def update(): global com_musica,musica,geral, passando, vx, vy, map_num, facing, mapa, esp_map, sprite, tempo, mouse_x, mouse_y

my_music = audio.playMusic(musica)
if com_musica:
    musica = "theme"
elif not com_musica:
    musica = ""
    my_music.stop(musica)
if geral >= 2:
    touchKeys_update()
    
    vx = 0
    vy = 0
    moving = False
    if checkInput(keyboard, "LEFT"):
        vx = -2
        facing = -1
        moving = True
    if checkInput(keyboard, "RIGHT"):
        vx = 2
        facing = 1
        moving = True
    if checkInput(keyboard, "UP"):
        vy = 2
        moving = True
    if checkInput(keyboard, "DOWN"):
        vy = -2
        moving = True
    sprite = "move" if moving else "sprite"
    physics()

mouse_x = mouse.x
mouse_y = mouse.y

def draw(): global com_musica,geral,passando,floor,dano,paraquedas,sprite,tempo,mouse_x,mouse_y screen.clear()

screen.setFont("AlphaBeta")
if geral == 0:
  

  if com_musica:
    sprites["opicoes"].setFrame(1)
  else:
    sprites["opicoes"].setFrame(0)
  screen.drawSprite( "opicoes", 0, 0, 128*1.5)
  screen.drawText("Música",0,63,16,"rgb(165,48,48)")
  if touch.x < -50 and mouse.y < -50 and mouse.x >- 92 and mouse.y >- 90:
    geral = 1
  if touch.x < 76 and touch.y < 76 and touch.x > 53 and touch.y > 53 and mouse.release:
    if com_musica:
      com_musica = False
    elif not com_musica:
      com_musica = True
if geral == 1:
  
  screen.drawSprite("tela_inicial",0,0, 256)
  screen.drawText("teste",0,65,32,"rgb(79,143,186)")
  screen.drawText("jogar",0,-15,16,"rgb(79,143,186)")
  screen.drawText("opções",0,-78,16,"rgb(57,74,80)")

  if mouse.x > -40 and mouse.x < 40 and mouse.y < 0 and mouse.y > -30 and mouse.release:
    geral = 2
  elif mouse_x > -40 and mouse_x < 40 and mouse_y < 0 and mouse_y > -30:
    sprites["tela_inicial"].setFrame(1)

#opçs elif mouse_x > -40 and mouse_x < 40 and mouse_y < -60 and mouse_y > -100 and mouse.release: geral = 0

  elif mouse_x > -40 and mouse_x < 40 and mouse_y < -60 and mouse_y > -100:
    sprites["tela_inicial"].setFrame(2)
  else:
    sprites["tela_inicial"].setFrame(0)
    
if geral >= 2:
  screen.fillRect(0, 0, screen.width, screen.height, "#000")
  screen.drawSprite("fundo", -hero_x-4.1, -hero_y+49, 128*8.13)
  screen.drawSprite("neve", 0, 0, 256+128)
  screen.setDrawScale(1, 1)
  screen.drawMap(mapa, -hero_x, -hero_y, 240*2, 240*2)
  screen.setDrawScale(facing, 1)
  screen.drawSprite(sprite, 0, 0, 20)
  screen.setDrawScale(1, 1)
  screen.drawSprite("vida", -150, 80, 32)
  screen.setAlpha(0.5)
  touchKeys_draw()
  screen.setAlpha(1)
  if morte:
    screen.drawSprite("morte", 0, 0, 400, 320)
    if time.time() - tempo > 1:
        init()
  if dano:
    screen.drawSprite("dano", 0, 0, 24, 24)
    if time.time() - tempo > 0.1:
        dano = False
  if passando:
    screen.drawSprite("passando", 0, 0, 360*2)
    if time.time() - tempo > 0.5:
        passando = False
  else:
    sprites["passando"].setFrame(0)

screen.drawSprite( "dano", mouse_x,mouse_y, 16, 16 )

TILE_PAREDE = "wall" TILE_TEIA = "teias" TILE_PEGAR = "pegar"

def tile_is_type(tile, tipo): if isinstance(tile, str): return tile.startswith(tipo) else: return tile == tipo

def physics(): global map_num,passando,sprite,dano,tempo,vy,vx,paraquedas,morte,hero_y,hero_x,landed,mapa,vida bottom = floor((hero_y + vy - 10 + 240) / 20) left = floor((hero_x + vx - 11 + 240) / 20) leftft = floor((hero_x + vx + 11 + 240) / 20) x = floor((hero_x + 240) / 20) y = floor((hero_y + 240) / 20) top = floor((hero_y - 8 + 240) / 20) tile1 = maps[mapa].get(left, top) tile2 = maps[mapa].get(left + 1, y)

if vy < 0 and tile_is_type(maps[mapa].get(x, bottom), TILE_PAREDE):
    hero_y = -240 + bottom * 20 + 30
    vy = 0
    landed = True
elif vy > 0 and tile_is_type(maps[mapa].get(x, bottom + 1), TILE_PAREDE):
    vy = 0
if vx < 0 and tile_is_type(maps[mapa].get(left, y), TILE_PAREDE):
    vx = 0
    hero_x = -240 + left * 20 + 30
elif vx > 0 and tile_is_type(maps[mapa].get(left + 1, y), TILE_PAREDE):
    vx = 0
    hero_x = -240 + left * 20 + 11

if tile_is_type(tile1, TILE_TEIA) or tile_is_type(tile2, TILE_TEIA):
    vx *= 0.3
    vy *= 0.3

if vida == 5:
    sprites["vida"].setFrame(0)
elif vida == 4:
    sprites["vida"].setFrame(1)
elif vida == 3:
    sprites["vida"].setFrame(2)
elif vida == 2:
    sprites["vida"].setFrame(3)
elif vida == 1:
    sprites["vida"].setFrame(4)
elif vida <= 0:
    morte = True
    sprites["vida"].setFrame(5)

if tile_is_type(tile1, TILE_PEGAR) or tile_is_type(tile2, TILE_PEGAR):
    map_num += 1
    mapa = "map" + str(map_num)
    passando = True
    hero_x = -200
    hero_y = 0
    tempo = time.time()
    if mapa == "map3":
        paraquedas = True
    else:
        paraquedas = False

hero_x += vx
hero_y += vy