Skip to content

Commit

Permalink
Merge pull request #249 from OmanshArora/master
Browse files Browse the repository at this point in the history
Create flappy.py
  • Loading branch information
fineanmol authored Oct 1, 2021
2 parents 13d4c60 + 850d6bd commit 9df7bce
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Contributors.html
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,29 @@ <h1 class="animated rubberBand delay-4s">Contributors</h1>
<a class="box-item" href="https://github.com/osamakhan552"><span>Osama Khan</span></a>
<a class="box-item" href="https://github.com/dynle"><span>Dynle</span></a>
<a class="box-item" href="https://github.com/Krutarth06"><span>Krutarth Trivedi</span></a>


<a class="box-item" href="https://github.com/Lukman350"><span>Lukman</span></a>

<a class="box-item" href="https://github.com/ShreyaChopra13"><span>Shreya </span></a>
<a class="box-item" href="https://github.com/adarshraghav"><span>Adarsh Raghav</span></a>
<a class="box-item" href="https://github.com/akash-10-23"><span>Akash Ratan Verma</span></a>
<a class="box-item" href="https://github.com/ana2407"><span>Vibhuti Negi</span></a>
<a class="box-item" href="https://github.com/ananya2407"><span>Ananya Sajwan</span></a>
<a class="box-item" href="https://github.com/husinassegaff"><span>Husin Muhammad Assegaff</span></a>
<a class="box-item" href="https://github.com/doniambarita"><span>Doni Ambarita</span></a>
<a class="box-item" href="https://github.com/matheusdaluz"><span>Matheus da Luz</span></a>
<a class="box-item" href="https://github.com/cheetosmaster"><span>cheetosmaster</span></a>
<a class="box-item" href="https://github.com/ramadh-an"><span>Nukholis Ramadhan</span></a>
<a class="box-item" href="https://github.com/OmanshArora"><span>Omansh</span></a>

<a class="box-item" href="https://github.com/ialexanderbrito"><span>Alexander</span></a>
<a class="box-item" href="https://github.com/rishabhrathore055"><span>Rishabh Rathore</span></a>
<a class="box-item" href="https://github.com/SukritSethi"><span>Sukrit Sethi</span></a>
<a class="box-item" href="https://github.com/faizalanwar"><span>faizalanwar</span></a>
<a class="box-item" href="https://github.com/chaitanyatekane"><span>Chaitanya</span></a>
<a class="box-item" href="https://github.com/srdevelopervishal"><span>vishal</span></a>

<a class="box-item" href="https://github.com/Lukman350"><span>Lukman</span></a>
<a class="box-item" href="https://github.com/ShreyaChopra13"><span>Shreya </span></a>
<a class="box-item" href="https://github.com/adarshraghav"><span>Adarsh Raghav</span></a>
Expand All @@ -236,6 +259,7 @@ <h1 class="animated rubberBand delay-4s">Contributors</h1>
<a class="box-item" href="https://github.com/chaitanyatekane"><span>Chaitanya</span></a>
<a class="box-item" href="https://github.com/srdevelopervishal"><span>vishal</span></a>
<a class="box-item" href="https://github.com/TheIndianRebel"><span>Parakram Singh Tanwer</span></a>

<a class="box-item" href="https://github.com/aaq007"><span>Aaqil Shihab</span></a>
<a class="box-item" href="https://github.com/OmanshArora"><span>Omansh</span></a>
<a class="box-item" href="https://github.com/todoroki07"><span>Rufus</span></a>
Expand Down
73 changes: 73 additions & 0 deletions Program's_Contributed_By_Contributors/Python_Programs/flappy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
from random import *
from turtle import *

from freegames import vector

bird = vector(0, 0)
balls = []


def tap(x, y):
"Move bird up in response to screen tap."
up = vector(0, 30)
bird.move(up)


def inside(point):
"Return True if point on screen."
return -200 < point.x < 200 and -200 < point.y < 200


def draw(alive):
"Draw screen objects."
clear()

goto(bird.x, bird.y)

if alive:
dot(10, 'green')
else:
dot(10, 'red')

for ball in balls:
goto(ball.x, ball.y)
dot(20, 'black')

update()


def move():
"Update object positions."
bird.y -= 5

for ball in balls:
ball.x -= 3

if randrange(10) == 0:
y = randrange(-199, 199)
ball = vector(199, y)
balls.append(ball)

while len(balls) > 0 and not inside(balls[0]):
balls.pop(0)

if not inside(bird):
draw(False)
return

for ball in balls:
if abs(ball - bird) < 15:
draw(False)
return

draw(True)
ontimer(move, 50)


setup(420, 420, 370, 0)
hideturtle()
up()
tracer(False)
onscreenclick(tap)
move()
done()

0 comments on commit 9df7bce

Please sign in to comment.