#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.. - วิทยาศาสตร์และเทคโนโลยี
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)
Neenga intha maari panrathu romba helpful a iruku anna
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
Podu Vera mari Thala 🔥🔥🔥
Bro ennakku varala bro eppadi
I like this video anna🎉
vara level bro
I can learn python only 20percent
🤩
Bro error kattuthu bro pygame screen open akamatinguthu bro
I am creating flappy bird game in phone and how to make that the bird will fly when tap the screen?
How to implement ai tools in python game Development like space shooting game Anna urgent reply.....
I like that music
Bro after creating how can we realese it in playstore.Please put a video for that also please
😇
Bro python script now u saying
So we can see and type
How to write our own python
Pls pls pls say
you mean your own programming language??
@@codinganna yes bro
That pubg music😘😘😘
Bro online game make pandrathu pathi sollunga
Souper
Nalla sing panneega
Mobile la pannalama bro..pls sollunga i am interested to develop game
Bro laptop Windows 10 la Panalam ah
Ennakum atha prechana than bro
Bro sys exit pattalum 1 sec la exit ayiduthu
I know c++,c# and java
Game screen vara mattaikuthu bro
bro error varuthu bro
Full program anuoungala
Anna that shooting eppa solli tharuvinga please solli thanga
Bro watch unity tutorials
Bro ithunala python varruthu pothu bro
Bro,trinket
Reply
Module not found error: no module name "pygame"
First download the pygame module...
pip install pygame
@@codinganna install successfully vanthuruchi bro analum game display varala no module name errors varuthu
@@gobijaya2582 are u on Instagram,,if yes then message me on my Instagram id: kishan_rajkkr
I will solve your problem ....
bro i also problem
Brother the modules are con't able to install
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
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..
Bro neenga Jarvis continue pannunga bro
Sure bro,,after this flappy bird i will make
@@codinganna thanks bro
Bro run aka mattaikuthu
Bro complete aaa check pannunga...next run pannunga
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
Bro pygame.init() SMALL letters la eluthanun
bro python paakama ithu paatha puriyuma
because my aim is to become a game devoloper please reply
and can I learn how to devolop big games in my own by watching flappy bird tutorials alone please reply
REPLY AS SOON AS POSSIBLE BRO VERY INTERESTING YOUR VIDEOS
no bro
@@codinganna OK BRO VERY VERY THANKS BRO.YOU WILL ACHIEVE GREAT ONE DAY BRO.
Olunga solithada.. elar life ah yum kedukatha... olunga pesu.... firstu😣
Bro this is very old video bro iam really sorry, u can watch my latest videos
Takkunu sollunga bro .you are wasting time.game development னு solitu.............😡😡😡😡😡😡😡
Sorry bro😔😔😭