Python Forum
[PyGame] bird jump in flappy bird games
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyGame] bird jump in flappy bird games
#1
I am making a game like flappy bird from scratch but I am confused about how to fly / jump that birds do in the game Flappy Bird .. How to do it?

import pygame
import sys


pygame.init()

window = pygame.display.set_mode((800, 600))


class Player:
    def __init__(self):
        self.move_x = 50
        self.move_y = 50
        self.vel = 0
        self.width = 20
        self.height = 20
        self.player = pygame.draw.rect(window, (255, 0, 0), (self.move_x, self.move_y, self.width, self.height))
        
    def update(self):
        pass


game_run = True

while True:

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            game_run = False
            pygame.quit()
            sys.exit()

    window.fill((0, 0, 0))

    player = Player()

    pygame.display.update()
Reply
#2
You need set keyboard binding for y movement so that the bird can go up and down. This is just the start of the game, you still have a lot of coding to do.
syafiq14 likes this post
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyGame] infinity jump problem augusto_A 3 1,505 May-27-2023, 01:17 AM
Last Post: deanhystad
  pygame double jump problem Yegor123 3 2,506 May-02-2023, 09:34 PM
Last Post: sudoku6
  [PyGame] Problems with jump code in pygame Joningstone 4 5,271 Aug-23-2021, 08:23 PM
Last Post: deanhystad
  [PyGame] Doodle Jump Dafteaser 2 4,431 May-25-2020, 09:06 AM
Last Post: lolloiltizio
  [PyGame] Having 4 players(Sprites) all being able to jump ElijahCastle 5 3,923 May-07-2019, 05:04 PM
Last Post: SheeppOSU
  Fun games to help with Low_Ki_ 2 4,049 May-10-2017, 01:23 AM
Last Post: Low_Ki_
  Doodle Jump themed game! georgecoopers 1 5,763 Apr-11-2017, 08:47 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020