flap.py

Created by randompenguin

Created on September 28, 2023

1.71 KB

Flappy Bird Calculator edition :)


'''
Thanks for choosing my Flappy Bird game!
I made this during high school, because
I was bored :) Have fun playing this
(not so) beautiful game!

Merci d'avoir choisi mon jeu de Flappy
Bird ! J'ai fait ce jeu pendant le lycee
parce que je m'ennuyais :) Amuse-toi
bien en jouant ce jeu (pas tres) beau !
'''

from ion import *
from kandinsky import *
from random import *
from time import *

def flap():
  x=100
  y=116
  gra=0.1
  vel=0
  crash=0
  flag=0
  count1=0
  count2=0
  wp2=173
  score=0
  fill_rect(100,106,10,10,'black')
  draw_string("START",135,140)
  sleep(1)
  fill_rect(135,140,50,15,'white')
  while crash!=1:
    fill_rect(x,int(round(y,0))-10,10,10,'white')
    if y-vel>=10:
      y-=vel
    if get_pixel(100,int(round(y,0)))==(0,0,0) or get_pixel(110,int(round(y,0)))==(0,0,0):
      crash=1
    if get_pixel(100,int(round(y-10,0)))==(0,0,0) or get_pixel(110,int(round(y-10,0)))==(0,0,0):
      crash=1
    fill_rect(x,int(round(y,0))-10,10,10,'black')
    if count1==0:
      yp1=randint(60,162)
      count1=336
    fill_rect(count1-16,0,1,yp1-40,'black')
    fill_rect(count1-16,yp1+40,1,320-(yp1+40),'black')
    fill_rect(count1-1,0,1,320,'white')
    count1-=1
    if wp2==0:
      if count2==0:
        yp2=randint(60,162)
        count2=336
      fill_rect(count2-16,0,1,yp2-40,'black')
      fill_rect(count2-16,yp2+40,1,320-(yp2+40),'black')
      fill_rect(count2-1,0,1,320,'white')
      count2-=1
    else:
      wp2-=1
    if count1==86 or count2==86:
      score+=1
    draw_string("Score: "+str(score),0,0)
    if keydown(4) and flag==0:
      vel=3
      flag=1
    else:
      vel-=gra
    if not keydown(4):
      flag=0
    if y>=222:
      crash=1
    sleep(0.01)
  draw_string("GAME OVER",115,101)

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.