Problem with makecode

Hello, I have a problem with my code but I can’t find the solution.
Thanks for your help

meteo1: game.LedSprite = None
meteo2: game.LedSprite = None
meteo3: game.LedSprite = None
meteo4: game.LedSprite = None
meteo5: game.LedSprite = None
joueur: game.LedSprite = None
nombre_choisi = 0

def on_logo_pressed():
    global meteo1, meteo2, meteo3, meteo4, meteo5, joueur
    meteo1 = game.create_sprite(4, 0)
    meteo2 = game.create_sprite(4, 1)
    meteo3 = game.create_sprite(4, 2)
    meteo4 = game.create_sprite(4, 3)
    meteo5 = game.create_sprite(4, 4)
    joueur = game.create_sprite(0, 2)
    for index in range(1000000400000000):
        for index2 in range(1000000400000000):
            for index3 in range(1000000400000000):
                for index4 in range(1000000400000000):
                    control.wait_micros(6000)
input.on_logo_event(TouchButtonEvent.PRESSED, on_logo_pressed)

def on_every_interval():
    global nombre_choisi
    nombre_choisi = randint(1, 5)
loops.every_interval(4000, on_every_interval)

def on_forever():
    if joueur.is_touching(meteo1):
        joueur.delete()
        meteo5.delete()
        meteo4.delete()
        meteo3.delete()
        meteo2.delete()
        meteo1.delete()
        basic.show_leds("""
            # . . . #
                        . # . # .
                        . . # . .
                        . # . # .
                        # . . . #
        """)
        basic.pause(1000)
    elif joueur.is_touching(meteo2):
        joueur.delete()
        meteo5.delete()
        meteo4.delete()
        meteo3.delete()
        meteo2.delete()
        meteo1.delete()
        basic.show_leds("""
            # . . . #
                        . # . # .
                        . . # . .
                        . # . # .
                        # . . . #
        """)
        basic.pause(1000)
    elif joueur.is_touching(meteo3):
        joueur.delete()
        meteo5.delete()
        meteo4.delete()
        meteo3.delete()
        meteo2.delete()
        meteo1.delete()
        basic.show_leds("""
            # . . . #
                        . # . # .
                        . . # . .
                        . # . # .
                        # . . . #
        """)
        basic.pause(1000)
    elif joueur.is_touching(meteo4):
        joueur.delete()
        meteo5.delete()
        meteo4.delete()
        meteo3.delete()
        meteo2.delete()
        meteo1.delete()
        basic.show_leds("""
            # . . . #
                        . # . # .
                        . . # . .
                        . # . # .
                        # . . . #
        """)
        basic.pause(1000)
    elif joueur.is_touching(meteo5):
        joueur.delete()
        meteo5.delete()
        meteo4.delete()
        meteo3.delete()
        meteo2.delete()
        meteo1.delete()
        basic.show_leds("""
            # . . . #
                        . # . # .
                        . . # . .
                        . # . # .
                        # . . . #
        """)
        basic.pause(1000)
basic.forever(on_forever)

def on_forever2():
    if nombre_choisi == 1:
        for index5 in range(4):
            meteo1.change(LedSpriteProperty.X, -1)
            for index6 in range(100):
                control.wait_micros(6000)
        meteo1.change(LedSpriteProperty.X, 4)
    if nombre_choisi == 2:
        for index7 in range(4):
            meteo2.change(LedSpriteProperty.X, -1)
            for index8 in range(100):
                control.wait_micros(6000)
        meteo2.change(LedSpriteProperty.X, 4)
    if nombre_choisi == 3:
        for index9 in range(4):
            meteo3.change(LedSpriteProperty.X, -1)
            for index10 in range(100):
                control.wait_micros(6000)
        meteo3.change(LedSpriteProperty.X, 4)
    if nombre_choisi == 4:
        for index11 in range(4):
            meteo4.change(LedSpriteProperty.X, -1)
            for index12 in range(100):
                control.wait_micros(6000)
        meteo4.change(LedSpriteProperty.X, 4)
    if nombre_choisi == 5:
        for index13 in range(4):
            meteo5.change(LedSpriteProperty.X, -1)
            for index14 in range(100):
                control.wait_micros(6000)
        meteo5.change(LedSpriteProperty.X, 4)
basic.forever(on_forever2)

I think you might be looking for the microbit section- you are in the makecode arcade section, which is for other consoles!

1 Like