Пример #1
0
def shooting():
    global bullet
    y = sprite.get_top(pushka_UwU)
    x = sprite.get_sprite_x(pushka_UwU)
    bullet = sprite.add_sprite("bullet", x, y)
    bullets.append(bullet)
    sprite.set_bottom_to(bullet, y)
Пример #2
0
def beskonechnoe_dvijenie_karika():
    global scorost
    for ball in balls:
        sprite.move_sprite_by(ball["number"], ball["scorostx"], ball["scorost"])
        ball["scorost"] += 1
        # print(ball["scorost"])
        # отбивка от низа
        niz = sprite.get_bottom(ball["number"])
        if niz >= 600:
            sprite.set_bottom_to(ball["number"], 600)
            ball["scorost"] = - ball["scorost"] * 0.9
            # if scorost < 9:
            if ball["scorost"] > -20:
                ball["scorost"] = - 20
            #     ball["scorost"]=-20
            print(ball["scorost"])
        # отбивка от правой границы
        right = sprite.get_right(ball["number"])
        if right >= 600:
            sprite.set_right_to(ball["number"], 600)
            ball["scorostx"] = - ball["scorostx"]

        left = sprite.get_left(ball["number"])
        if left <= 0:
            sprite.set_left_to(ball["number"], 0)
            ball["scorostx"] = -ball["scorostx"]
        sprite.move_sprite_to(ball["ballhp"],sprite.get_sprite_x(ball["number"]),sprite.get_sprite_y(ball["number"]))
Пример #3
0
def move_ball():
    for b in all_ball:
        x = sprite.get_sprite_x(b)
        y = sprite.get_sprite_y(b)
        sprite.move_sprite_to(b, x, y + 10)
        v = print(sprite.get_sprite_y(b))
        if v == 600:
            print('dimon! yletel')
Пример #4
0
def shof_bullet():
    for a in all_bullet:
        x = sprite.get_sprite_x(a)
        y = sprite.get_sprite_y(a) - 10
        sprite.move_sprite_to(a, x, y)
Пример #5
0
def add_bullet():
    bullet = sprite.add_sprite('bullet', sprite.get_sprite_x(pushka),
                               sprite.get_sprite_y(pushka))
    all_bullet.append(bullet)
Пример #6
0
world.create_world(600, 600)
world.set_world_background_color_rgb(27, 195, 255)

spot1 = sprite.add_sprite("pacman",
                          randint(1, 600),
                          randint(1, 600),
                          costume="dot")
spot2 = sprite.add_sprite("pacman",
                          x=randint(1, 600),
                          y=randint(1, 600),
                          costume="dot")

hero = sprite.add_sprite("pacman", 300, 300, costume="player2")

sprite.change_sprite_size_proc(hero, 110, 110)
sprite_actions.rotate_to_point(hero, 1000, sprite.get_sprite_x(spot1),
                               sprite.get_sprite_y(spot1))
sprite_actions.move_sprite_to(hero, 1000, sprite.get_sprite_x(spot1),
                              sprite.get_sprite_y(spot1))
sprite.hide_sprite(spot1)
sprite.change_sprite_size_proc(hero, 130, 130)

sprite_actions.rotate_to_point(hero, 1000, sprite.get_sprite_x(spot2),
                               sprite.get_sprite_y(spot2))
sprite_actions.move_sprite_to(hero, 1000, sprite.get_sprite_x(spot2),
                              sprite.get_sprite_y(spot2))
sprite.hide_sprite(spot2)
sprite.change_sprite_size_proc(hero, 150, 150)

enemy = sprite.add_sprite("pacman",
                          sprite.get_right(hero) + 10,
Пример #7
0
def dvigat_ruku():
    skorost = 0
    ruka_x = sprite.get_sprite_x(ruka)
    sprite.move_sprite_to(ruka, skorost + ruka_x, 450)
    if ruka_x > 480:
        print("opasnost")