project 12

Python
@namespace
class SpriteKind:
    Obstacle = SpriteKind.create()
    Ground = SpriteKind.create()

def on_on_overlap(sprite, otherSprite):
    game.game_over(False)
sprites.on_overlap(SpriteKind.player, SpriteKind.Obstacle, on_on_overlap)

def on_a_pressed():
    if hero.y >= 106:
        hero.vy = -145
controller.A.on_event(ControllerButtonEvent.PRESSED, on_a_pressed)

def on_countdown_end():
    game.game_over(True)
info.on_countdown_end(on_countdown_end)

def on_on_overlap2(sprite2, otherSprite2):
    info.change_score_by(1)
    sprites.destroy(otherSprite2)
sprites.on_overlap(SpriteKind.player, SpriteKind.food, on_on_overlap2)

block: Sprite = None
coin: Sprite = None
ground: Sprite = None
hero: Sprite = None
info.set_score(0)
info.start_countdown(10)
scene.set_background_color(13)
game.splash("Untitled")
hero = sprites.create(img("""
        cccccccccccccccccccc
        cccccccccccccccccccc
        cccccccccccccccccccc
        cccccccccccccccccccc
        cccccccccccccccccccc
        cccccccccccccccccccc
        cccccccccccccccccccc
        cccccccccccccccccccc
        cccccccccccccccccccc
        cccccccccccccccccccc
        cccccccccccccccccccc
        cccccccccccccccccccc
        cccccccccccccccccccc
        cccccccccccccccccccc
        cccccccccccccccccccc
        cccccccccccccccccccc
        cccccccccccccccccccc
        cccccccccccccccccccc
        cccccccccccccccccccc
        cccccccccccccccccccc
        """),
    SpriteKind.player)
hero.set_position(28, 108)
hero.ay = 360
for i in range(11):
    ground = sprites.create(img("""
            . . . . . . . . . . . . . . . .
            . . . . . . . . . . . . . . . .
            . . . . . . . . . . . . . . . .
            d d d d d d d d d d d d d d d d
            8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
            1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
            1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
            1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
            """),
        SpriteKind.Ground)
    ground.set_flag(SpriteFlag.GHOST, True)
    ground.z = -10
    ground.x = i * 16 + 8
    ground.y = 116
game.set_game_over_message(False, "GAME OVER!")
game.set_game_over_effect(False, effects.hearts)
game.set_game_over_playable(False, music.melody_playable(music.siren), True)
game.set_game_over_message(True, "WIN!")
game.set_game_over_effect(True, effects.star_field)
game.set_game_over_playable(True, music.melody_playable(music.magic_wand), True)

def on_on_update():
    if hero.y > 108:
        hero.y = 108
        hero.vy = 0
game.on_update(on_on_update)

def on_update_interval():
    global coin
    coin = sprites.create(img("""
            . . . . . . . . . . . . . . . .
            . . . . . . . . . . . . . . . .
            . . . . . . . . . . . . . . . .
            . . . . . . . . . . . . . . . .
            . . . . . . . . . . . . . . . .
            . . . . . . . . . . . . . . . .
            . . . . . . 3 3 3 3 . . . . . .
            . . . . . . 3 . . 3 3 . . . . .
            . . . . . 3 3 . . . 3 . . . . .
            . . . . . . 3 . . 3 3 . . . . .
            . . . . . . 3 3 3 3 . . . . . .
            . . . . . . . . . . . . . . . .
            . . . . . . . . . . . . . . . .
            . . . . . . . . . . . . . . . .
            . . . . . . . . . . . . . . . .
            . . . . . . . . . . . . . . . .
            """),
        SpriteKind.food)
    coin.set_position(170, 80)
    coin.set_velocity(-90, 0)
game.on_update_interval(1500, on_update_interval)

def on_update_interval2():
    global block
    block = sprites.create_projectile(img("""
            6 6 6 6 6 6
            6 6 6 6 6 6
            6 6 6 6 6 6
            6 6 6 6 6 6
            6 6 6 6 6 6
            6 6 6 6 6 6
            6 6 6 6 6 6
            6 6 6 6 6 6
            6 6 6 6 6 6
            6 6 6 6 6 6
            6 6 6 6 6 6
            6 6 6 6 6 6
            6 6 6 6 6 6
            6 6 6 6 6 6
            6 6 6 6 6 6
            6 6 6 6 6 6
            """),
        -90,
        0,
        SpriteKind.Obstacle)
    block.set_position(scene.screen_width(), 108)
game.on_update_interval(1200, on_update_interval2)
a.traversa
Sign in to react
Uploaded Sep 10, 2026