#2 FlappyBirdGame:: Display Surfaces & FPS in Pygame || GameDevelopment Tutorials || CodingAnna

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 ส.ค. 2020
  • To help me Make such videos Please Donate::
    / @codinganna
    #2 FlappyBirdGame:: Display Surfaces & FPS in Pygame || GameDevelopment Tutorials || CodingAnna
    Game Development tutorials :: • GameDevelopment in tam...
    Python Tutorials :: • Python by codingAnna
    Coding Anna :::: / @codinganna
    Gaming Anna :::: / @kishancjx-official
    #CodingAnna #codinganna #pythontutorials #tamilprogramming #pythontutorialintamil
    #GameDevelopmentCodingAnna #gamesmakingintamil #gamedevelopment
    Today we will see that how we can create games,, and i will soon upload videos about game development,.. so please do subscribe....
    Follow Me on instagram: / kishan_rajkkr
    Follow me On FaceBook: / codingannaofficial
    Follow me On Twitter: / kishanrajkkr
    Thanks For Watching This Video..
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 66

  • @rejoram1912
    @rejoram1912 3 ปีที่แล้ว +13

    anybody want the full code use this this can run perfectly
    import pygame
    import sys
    import random
    #for all the functions
    def bgku():
    screen.blit(bg_surface, (bgxposition, 0))
    screen.blit(bg_surface, (bgxposition + 288, 0))
    def floorxku():
    screen.blit(floor, (floorxposition, 420))
    screen.blit(floor,(floorxposition+288,420))
    def createpipe():
    randheight = random.choice(pipe_height)
    bottompipe=pipe_surface.get_rect(midtop=(400,randheight))
    toppipe=pipe_surface.get_rect(midbottom=(400,randheight-150))
    return bottompipe,toppipe
    def movepipes(pipes):
    for pipe in pipes:
    pipe.centerx-=2
    return pipes
    def draw_pipes(pipes):
    for pipe in pipes:
    if pipe.bottom>=512:
    screen.blit(pipe_surface,pipe)
    else:
    flippipe=pygame.transform.flip(pipe_surface,False,True)
    screen.blit(flippipe,pipe)
    def checkcollis(pipes):
    for pipe in pipes:
    if bird_rect.colliderect(pipe):
    hitsound.play()
    return False
    if bird_rect.top=420:
    hitsound.play()
    return False
    return True
    def rotate_bird(bird):
    new_bird=pygame.transform.rotozoom(bird,-bird_y_movement*3,1)
    return new_bird
    def score_display(game_state):
    if game_state=="mainstate":
    score_suface=game_font.render(f"scorula::{str(int(score))}",True,(255,5,5))
    score_rect=score_suface.get_rect(center=(146,50))
    screen.blit(score_suface,score_rect)
    if game_state=="gameover":
    score_suface = game_font.render(f"score::{str(int(score))}",True,(255,5,5))
    score_rect = score_suface.get_rect(center=(146, 50))
    screen.blit(score_suface, score_rect)
    high_score_suface = game_font.render(f"highscore ivlothan::{str(int(highscore))}",True,(255,255,25))
    high_score_rect = high_score_suface.get_rect(center=(146, 400))
    screen.blit(high_score_suface, high_score_rect)
    def update_score(score,highscore):
    if score>highscore:
    highscore=score
    return highscore
    #game variables
    gravity=0.140
    scoreplay=0
    bird_y_movement=0
    pygame.mixer.init(frequency=44100,size=-16,channels=2,buffer=512)
    pygame.init()
    screen=pygame.display.set_mode((288,512))
    clock=pygame.time.Clock()
    score=0
    highscore=0
    bgxposition =0
    #game image inputs
    game_active =True
    bg_surface=pygame.image.load('assets/background-night.png').convert()
    floor=pygame.image.load('assets/base.png').convert()
    bird_surface=pygame.image.load('assets/yellowbird-midflap.png').convert_alpha()
    pipe_surface=pygame.image.load('assets/pipe-green.png').convert()
    bird_rect=bird_surface.get_rect(center=(78,288))
    gameoverscreen=pygame.image.load('assets/gameover.png').convert_alpha()
    gameoverrect=gameoverscreen.get_rect(center=(144,256))
    lst=[]
    spawnpipe=pygame.USEREVENT
    pygame.time.set_timer(spawnpipe,1200)
    floorxposition=0
    game_font=pygame.font.Font("HeadlinerNo.45DEMO.ttf",40)
    pipe_height =[195,200,205,210,220,230,240,250,260,270,280,290,300,310,320,330,340,350,360,370,380]
    #sound
    flapsound=pygame.mixer.Sound('sound/sfx_wing.wav')
    hitsound=pygame.mixer.Sound('sound/sfx_hit.wav')
    pointsound=pygame.mixer.Sound('sound/sfx_point.wav')
    wtfsound=pygame.mixer.Sound('sound/wtfmp4.wav')
    diesound=pygame.mixer.Sound('sound/sfx_die.wav')
    #main loop
    while True:
    for event in pygame.event.get():
    if event.type==pygame.QUIT:
    pygame.quit()
    sys.exit()
    if event.type==pygame.KEYDOWN:
    if event.key==pygame.K_SPACE:
    bird_y_movement=0
    bird_y_movement =bird_y_movement - 5
    flapsound.play()
    if event.type == pygame.KEYDOWN and game_active==False:
    game_active=True
    lst.clear()
    bird_rect.center=(76,200)
    bird_y_movement=0
    score=0
    wtfsound.stop()
    if event.type==spawnpipe:
    lst.extend(createpipe())
    bgxposition = bgxposition - 1
    floorxposition -= 1
    bgku()
    if game_active:
    score=score+0.01
    scoreplay+=0.01
    if scoreplay>1:
    pointsound.play()
    scoreplay=0
    score_display('mainstate')
    lst=movepipes(lst)
    draw_pipes(lst)
    bird_y_movement += gravity
    bird_rect.centery+=bird_y_movement
    rotated_bird=rotate_bird(bird_surface)
    screen.blit(rotated_bird,bird_rect)
    game_active=checkcollis(lst)
    else:
    score_display('gameover')
    highscore=update_score(score,highscore)
    screen.blit(gameoverscreen,gameoverrect)
    wtfsound.play()
    floorxku()
    if floorxposition==-288 and bgxposition == -288:
    floorxposition=0
    bgxposition = 0
    pygame.display.update()
    clock.tick(120)

  • @4Trends
    @4Trends 2 ปีที่แล้ว +3

    Neenga intha maari panrathu romba helpful a iruku anna

  • @maestroxo3075
    @maestroxo3075 3 ปีที่แล้ว +6

    Thanks for doing this bro naan unga video va share panraen bro full support for you bro unga video full ah puridhubro enakkum teacher oruthan irukkan bro avn laam thooku maatikanum

  • @RogueV
    @RogueV 3 ปีที่แล้ว +6

    Podu Vera mari Thala 🔥🔥🔥

  • @mouleeshwar.g3335
    @mouleeshwar.g3335 7 หลายเดือนก่อน

    I like this video anna🎉

  • @ranjeeb7668
    @ranjeeb7668 3 ปีที่แล้ว

    vara level bro

  • @rps2108
    @rps2108 3 ปีที่แล้ว +6

    I can learn python only 20percent

  • @joohikumari6753
    @joohikumari6753 3 ปีที่แล้ว +3

    🤩

  • @mohammadaskar9698
    @mohammadaskar9698 2 ปีที่แล้ว +1

    Bro error kattuthu bro pygame screen open akamatinguthu bro

  • @jannaths8954
    @jannaths8954 3 ปีที่แล้ว +1

    I am creating flappy bird game in phone and how to make that the bird will fly when tap the screen?

  • @mouleeshwar.g3335
    @mouleeshwar.g3335 10 หลายเดือนก่อน

    How to implement ai tools in python game Development like space shooting game Anna urgent reply.....

  • @dlashokofficial4215
    @dlashokofficial4215 2 ปีที่แล้ว

    I like that music

  • @dhanasekarankaruppiah7567
    @dhanasekarankaruppiah7567 3 ปีที่แล้ว +2

    Bro after creating how can we realese it in playstore.Please put a video for that also please

  • @COBRA-lr9sw
    @COBRA-lr9sw 3 ปีที่แล้ว +1

    😇

  • @tamilanmusic1777
    @tamilanmusic1777 3 ปีที่แล้ว +3

    Bro python script now u saying
    So we can see and type
    How to write our own python
    Pls pls pls say

    • @codinganna
      @codinganna  3 ปีที่แล้ว +1

      you mean your own programming language??

    • @tamilanmusic1777
      @tamilanmusic1777 3 ปีที่แล้ว +1

      @@codinganna yes bro

  • @_kalaiarasi_5833
    @_kalaiarasi_5833 3 ปีที่แล้ว +2

    That pubg music😘😘😘

  • @KCHANDURUS
    @KCHANDURUS 3 ปีที่แล้ว

    Bro online game make pandrathu pathi sollunga

  • @dlashokofficial4215
    @dlashokofficial4215 2 ปีที่แล้ว

    Souper

  • @pubgcalling2000
    @pubgcalling2000 3 ปีที่แล้ว

    Nalla sing panneega

  • @onnurendumoonu7118
    @onnurendumoonu7118 2 ปีที่แล้ว

    Mobile la pannalama bro..pls sollunga i am interested to develop game

  • @syedkhaderbasha771
    @syedkhaderbasha771 3 ปีที่แล้ว +1

    Bro laptop Windows 10 la Panalam ah

  • @king_opm
    @king_opm ปีที่แล้ว

    Bro sys exit pattalum 1 sec la exit ayiduthu

  • @rizwanafarween7371
    @rizwanafarween7371 ปีที่แล้ว

    I know c++,c# and java

  • @gobijaya2582
    @gobijaya2582 3 ปีที่แล้ว +1

    Game screen vara mattaikuthu bro

  • @anonymous71016
    @anonymous71016 3 ปีที่แล้ว +2

    bro error varuthu bro

  • @ArunArun-py7lt
    @ArunArun-py7lt 8 หลายเดือนก่อน

    Full program anuoungala

  • @sivasankari6070
    @sivasankari6070 3 ปีที่แล้ว +1

    Anna that shooting eppa solli tharuvinga please solli thanga

    • @codinganna
      @codinganna  3 ปีที่แล้ว

      Bro watch unity tutorials

  • @mohammadaskar9698
    @mohammadaskar9698 2 ปีที่แล้ว

    Bro ithunala python varruthu pothu bro

  • @dc0274
    @dc0274 3 ปีที่แล้ว

    Bro,trinket

    • @dc0274
      @dc0274 3 ปีที่แล้ว

      Reply

  • @gobijaya2582
    @gobijaya2582 3 ปีที่แล้ว

    Module not found error: no module name "pygame"

    • @codinganna
      @codinganna  3 ปีที่แล้ว

      First download the pygame module...

    • @codinganna
      @codinganna  3 ปีที่แล้ว

      pip install pygame

    • @gobijaya2582
      @gobijaya2582 3 ปีที่แล้ว

      @@codinganna install successfully vanthuruchi bro analum game display varala no module name errors varuthu

    • @codinganna
      @codinganna  3 ปีที่แล้ว

      @@gobijaya2582 are u on Instagram,,if yes then message me on my Instagram id: kishan_rajkkr
      I will solve your problem ....

    • @vanithasenthil5044
      @vanithasenthil5044 2 ปีที่แล้ว +1

      bro i also problem

  • @sureshnaveenkumar3338
    @sureshnaveenkumar3338 4 ปีที่แล้ว

    Brother the modules are con't able to install

    • @codinganna
      @codinganna  4 ปีที่แล้ว

      Bro try to install it from unofficial binaries for python,..if u don't know,,please contact me,,,Instagram, Facebook, link is in the description of this video..my email id::mr.x.kkr111118@gmail.com
      Contact me anywhere

    • @codinganna
      @codinganna  3 ปีที่แล้ว

      Bro it is konjam kastam,,so if you don't know ,search on TH-cam for solution,,or my Instagram id is instagram.com/kishan_rajkkr/
      ask me here..

    • @santhoshr3366
      @santhoshr3366 3 ปีที่แล้ว

      Bro neenga Jarvis continue pannunga bro

    • @codinganna
      @codinganna  3 ปีที่แล้ว

      Sure bro,,after this flappy bird i will make

    • @santhoshr3366
      @santhoshr3366 3 ปีที่แล้ว

      @@codinganna thanks bro

  • @gobijaya2582
    @gobijaya2582 3 ปีที่แล้ว +1

    Bro run aka mattaikuthu

    • @codinganna
      @codinganna  3 ปีที่แล้ว

      Bro complete aaa check pannunga...next run pannunga

    • @gobijaya2582
      @gobijaya2582 3 ปีที่แล้ว

      Import pygame
      Pygame. Init()
      Screen=pygame. display. set_mode((288,512))
      #apram run panduna name module errors varuthu bro Ana na pip install pygame install akiruchi bro

    • @codinganna
      @codinganna  3 ปีที่แล้ว

      Bro pygame.init() SMALL letters la eluthanun

  • @tanish1956
    @tanish1956 3 ปีที่แล้ว

    bro python paakama ithu paatha puriyuma

    • @tanish1956
      @tanish1956 3 ปีที่แล้ว

      because my aim is to become a game devoloper please reply

    • @tanish1956
      @tanish1956 3 ปีที่แล้ว

      and can I learn how to devolop big games in my own by watching flappy bird tutorials alone please reply

    • @tanish1956
      @tanish1956 3 ปีที่แล้ว

      REPLY AS SOON AS POSSIBLE BRO VERY INTERESTING YOUR VIDEOS

    • @codinganna
      @codinganna  3 ปีที่แล้ว

      no bro

    • @tanish1956
      @tanish1956 3 ปีที่แล้ว

      @@codinganna OK BRO VERY VERY THANKS BRO.YOU WILL ACHIEVE GREAT ONE DAY BRO.

  • @massmanish8136
    @massmanish8136 3 ปีที่แล้ว

    Olunga solithada.. elar life ah yum kedukatha... olunga pesu.... firstu😣

    • @codinganna
      @codinganna  3 ปีที่แล้ว

      Bro this is very old video bro iam really sorry, u can watch my latest videos

  • @believepower7790
    @believepower7790 3 ปีที่แล้ว

    Takkunu sollunga bro .you are wasting time.game development னு solitu.............😡😡😡😡😡😡😡

    • @codinganna
      @codinganna  3 ปีที่แล้ว

      Sorry bro😔😔😭