@jajoosam/

TotalGrippingChapter

Python

No description

fork
loading
Files
  • main.py
  • requirements.txt

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.8936366323369587","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"aW1wb3J0IHBsYXkKCmJpcmQgPSBwbGF5Lm5ld19jaXJjbGUoCiAgICBjb2xvcj0neWVsbG93JywKICAgIHg9cGxheS5zY3JlZW4ubGVmdCArIDEwMCwKICAgIHk9cGxheS5zY3JlZW4udG9wIC0gNDAsCiAgICByYWRpdXM9MzAsCikKCiMgYWRkaW5nIGdyYXZpdHkgYW5kIGxvdHNhIG90aGVyIHBoeXNpY3MgdG8gb3VyIGJpcmQKYmlyZC5zdGFydF9waHlzaWNzKGJvdW5jaW5lc3M9MC40KQoKYm94ZXMgPSBbXQoKCkBwbGF5LnJlcGVhdF9mb3JldmVyCmRlZiBkbygpOgogICAgaWYgcGxheS5rZXlfaXNfcHJlc3NlZCgnc3BhY2UnLCAndXAnLCAndycpOgogICAgICAgICMgaWYgdGhlIHVwIGtleSBpcyBwcmVzc2VkLCBtYWtlIHRoZSBiaXJkIGp1bXAKICAgICAgICBiaXJkLnkgKz0gNQoKICAgIGZvciBib3ggaW4gYm94ZXM6CgogICAgICAgICMgaWYgdGhlIGJveCBpcyBvdXQgb2YgdGhlIHNjcmVlbiwgbGV0cyBkZWxldGUgaXQKICAgICAgICBpZihib3gueCA8IChwbGF5LnNjcmVlbi5sZWZ0LTEwMCkpOgogICAgICAgICAgICBib3hlcy5yZW1vdmUoYm94KQogICAgICAgICAgICBib3gucmVtb3ZlKCkKCiAgICAgICAgIyBkZXRlY3QgaWYgdGhlIGJpcmQgaXMgdG91Y2hpbmcgYW55IGJveAoKICAgICAgICBpZiBiaXJkLmlzX3RvdWNoaW5nKGJveCk6CiAgICAgICAgICAgIHBsYXkubmV3X3RleHQod29yZHM9J3lvdSBkaWVkIDooJykKCiAgICAgICAgICAgIGJpcmQuc3RvcF9waHlz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GNyZWF0aW5nIHRoZSBuZXh0IGJveCBhZnRlciBhIHJhbmRvbSBkdXJhdGlvbiBiZXR3ZWVuIDIgYW5kIDUgc2Vjb25kcwogICAgYXdhaXQgcGxheS50aW1lcihzZWNvbmRzPXBsYXkucmFuZG9tX251bWJlcigyLjAsIDUuMCkpCgpwbGF5LnN0YXJ0X3Byb2dyYW0oKQo="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import play

bird = play.new_circle(
    color='yellow',
    x=play.screen.left + 100,
    y=play.screen.top - 40,
    radius=30,
)

# adding gravity and lotsa other physics to our bird
bird.start_physics(bounciness=0.4)

boxes = []


@play.repeat_forever
def do():
    if play.key_is_pressed('space', 'up', 'w'):
        # if the up key is pressed, make the bird jump
        bird.y += 5

    for box in boxes:

        # if the box is out of the screen, lets delete it
        if(box.x < (play.screen.left-100)):
            boxes.remove(box)
            box.remove()

        # detect if the bird is touching any box

        if bird.is_touching(box):
            play.new_text(words='you died :(')

            bird.stop_physics()

            # remove each box
            for z in boxes:
                z.remove()

        # make the box move to the left
        box.x -= 1


@play.repeat_forever
async def block():
    # height of the top block
    top = play.random_number(lowest=300, highest=600)
    # height of the bottom block
    bottom = play.random_number(lowest=300, highest=500)

    # creating the top box of width 100, emerging from behind the current screen
    boxes.append(play.new_box(color="blue", y=play.screen.top,
                              x=play.screen.right+100, width=100, height=top))

    # creating the bottom box of width 100, emerging from behind the current screen
    boxes.append(play.new_box(color="blue", y=play.screen.bottom,
                              x=play.screen.right+100, width=100, height=bottom))

    # creating the next box after a random duration between 2 and 5 seconds
    await play.timer(seconds=play.random_number(2.0, 5.0))

play.start_program()