@jajoosam/

flappy bird

Pygame

with python play!

fork
loading
Files
  • main.py
  • nohup.out
  • requirements.txt

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.895637659894978","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"aW1wb3J0IHBsYXkKCmJpcmQgPSBwbGF5Lm5ld19jaXJjbGUoCiAgICBjb2xvcj0neWVsbG93JywKICAgIHg9cGxheS5zY3JlZW4ubGVmdCArIDEwMCwKICAgIHk9cGxheS5zY3JlZW4udG9wIC0gNDAsCiAgICByYWRpdXM9MzAsCikKCiMgYWRkaW5nIGdyYXZpdHkgYW5kIGxvdHNhIG90aGVyIHBoeXNpY3MgdG8gb3VyIGJpcmQKYmlyZC5zdGFydF9waHlzaWNzKGJvdW5jaW5lc3M9MC40KQoKYm94ZXMgPSBbXQoKCkBwbGF5LnJlcGVhdF9mb3JldmVyCmRlZiBkbygpOgogICAgaWYgcGxheS5rZXlfaXNfcHJlc3NlZCgndXAnLCAndycpOgogICAgICAgICMgaWYgdGhlIHVwIGtleSBpcyBwcmVzc2VkLCBtYWtlIHRoZSBiaXJkIGp1bXAKICAgICAgICBiaXJkLnkgKz0gNy41CgogICAgZm9yIGJveCBpbiBib3hlczoKCiAgICAgICAgIyBpZiB0aGUgYm94IGlzIG91dCBvZiB0aGUgc2NyZWVuLCBsZXRzIGRlbGV0ZSBpdAogICAgICAgIGlmIChib3gueCA8IChwbGF5LnNjcmVlbi5sZWZ0IC0gNTApKToKICAgICAgICAgICAgYm94ZXMucmVtb3ZlKGJveCkKICAgICAgICAgICAgYm94LnJlbW92ZSgpCgogICAgICAgICMgZGV0ZWN0IGlmIHRoZSBiaXJkIGlzIHRvdWNoaW5nIGFueSBib3gKICAgICAgICBpZiBiaXJkLmlzX3RvdWNoaW5nKGJveCk6CiAgICAgICAgICAgIGJveC5jb2xvciA9ICJyZWQiCgogICAgICAgICMgbWFrZSB0aGUgYm94IG1vdmUgdG8gdGhlIGxlZnQKICAg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Ugc2Vjb25kcwogICAgYXdhaXQgcGxheS50aW1lcihzZWNvbmRzPXBsYXkucmFuZG9tX251bWJlcigxLjAsIDQuMCkpCgoKcGxheS5zdGFydF9wcm9ncmFtKCkK"},"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
64
65
66
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('up', 'w'):
        # if the up key is pressed, make the bird jump
        bird.y += 7.5

    for box in boxes:

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

        # detect if the bird is touching any box
        if bird.is_touching(box):
            box.color = "red"

        # 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=500)
    # 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 + 50,
            width=50,
            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 + 50,
            width=50,
            height=bottom))

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


play.start_program()