#๐Ÿ”’ Trying to make a Flappy bird game

94 messages ยท Page 1 of 1 (latest)

tulip patrol
#

I saw a youtube video about a guy using python in sublime text to create a mock version of Flappy Bird
So I tried copying his basic codes, his video is basically a tutorial explaining every step in creating the game. But after trying to Build the code with sublime text, nothing appears like the "app" that appeared on his video.
Code:

import pygame

pygame.init()
screen = pygame.display.set_mode((500,800))
pygame.display.set_caption('Boblox')
running = True
GREEN = (0, 200, 0)
clock = pygame.time.Clock()

while running:
clock.tick(60)
screen.fill(GREEN)

for event in pygame.event.get():
    if event.type ==pygame.QUIT:
            running = False

pygame.display.flip()

pygame.quit()

dreamy juniperBOT
#

@tulip patrol

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

tulip patrol
#

What supposed to happen is there's a green screen app looking like thing that pops up

#

But there's nothing here

charred quarry
#

The code is correct and works. How are you running it?

tulip patrol
#

Erm? Ctrl + S + B ?

#

To build it in Sublime Text

exotic rivet
#

Let's ignore sublime text for a moment since I don't know what it does for python. Let's try running your program from a terminal. In a terminal run:

python main.py

Assuming you named the files main.py. Use whatever name you called the file.

tulip patrol
#

Is it not the way to do it?

charred quarry
#

Yeah, it's easiest to see what's wrong if you run it in the terminal

tulip patrol
#

im using windows and uh gimme a sec

charred quarry
#

You can run it with cmd.exe in Windows

#

sublime probably has an integrated terminal window

tulip patrol
#

k it says no module named pygame

#

did i forget to download something

charred quarry
#

Right, so you haven't installed pygame

exotic rivet
#

(btw, I tested your code above and it opens a green window, so we're gonna work on runnign it in python and making sure pygame in stalled)

tulip patrol
#

So how exactly do i download this pygame?

charred quarry
#

Did the guide you followed not talk about that?

tulip patrol
#

and what is it?

charred quarry
#

pygame is a game development framework for Python

tulip patrol
#

Also for some reason, the right click to open command space here in windows no longer exist?

exotic rivet
#

pip install pygame to install it.

(btw, we should install this in a virtual environment, but for for now, we'll jst install it globally. it's a bad practice, but it doesn't matter for today)

tulip patrol
#

Most of the guides i found are using that way to open and write their codes

#

will this affects anything afterward?

exotic rivet
#

nah.

tulip patrol
#

ModuleNotFoundError: No module named 'setuptools._distutils.msvccompiler'
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed to build 'pygame' when getting requirements to build wheel

#

Erm

charred quarry
tulip patrol
#

It goes a longggggggggg way then there's that at the end

exotic rivet
#

That error means: "We need compile pygame from source code and I can't find a C compiler to do so".

What python are you on? python --version

tulip patrol
#

3.14.2

#

is it an old one or smth?

exotic rivet
#

no, it's new. it's good.

charred quarry
#

Maybe pygame-ce instead of pygame

tulip patrol
charred quarry
#

dunno if pygame has 3.14 support yet

old goblet
#

Can I chime in and suggest pip install pygame-ce instead? I suspect that the original pygame has issues with the latest python release, may not work with python 3.14

exotic rivet
#

Some python libraries have c/c++ components. Expecially something like pygame that may need to use opengl/DirectX or other graphics libraries.

#

You don't need to write any C. It uses it internally to the pygame library.

tulip patrol
#

Okay i understand 15% of what you said but ill try

charred quarry
#

@tulip patrol

tulip patrol
#

I suppose i run pip install pygame-ce this now?

charred quarry
tulip patrol
#

okay it installed successful

#

OHHHHHHH

#

I RAN the file

old goblet
#

Awesome, now try running you pygame code

tulip patrol
#

There goes my green box

#

๐Ÿ”ฅ

charred quarry
#

Now you just gotta learn Python and then pygame and then you can make your own 2D games

tulip patrol
#

I wanna ask one more thing

exotic rivet
tulip patrol
#

Im currently following a free course on python that goes over most of the stuffs?
I've been through the basics like list, tuple, str, float, int. What do I study next?

charred quarry
#

pygame-ce is essentially the official pygame release nowadays

charred quarry
# tulip patrol Im currently following a free course on python that goes over most of the stuffs...
#

^ All of these are great beginner resources

#

And they cover all the fundamentals

tulip patrol
#

I know this sounds stupid but uh what exactly can i do with python?

#

People told me its not that great in terms of making games

exotic rivet
#

Anything*

tulip patrol
#

Nor does it run a website

charred quarry
charred quarry
tulip patrol
#

So how do i make my website and make it run my print('Hello World')?

charred quarry
#

Though you'd probably want to use something else for making a commercial game.

charred quarry
harsh warren
exotic rivet
#

Python isn't really used for any big AAA games, but it's a great general purpose programming language, useful to learn, and perfectly capable of many games.

tulip patrol
#

what exactly does this mean

#

so python can be used to run a website

charred quarry
tulip patrol
#

but i cannot show my stuffs on it?

charred quarry
#

Yes, you can

tulip patrol
#

okay lets say i have a py file with some codes in it, how do i turn that file into a web?

#

or does it go deeper than that?

charred quarry
drifting lintel
#

had a look at the top 10 "overwhelmingly positive" games on steam yesterday, I saw 4 of them that could be written in python with no impact on performance

tulip patrol
#

Idk what language but i saw someone being able to write some codes and when they click run it changes on the website on google as well

#

thought that was kinda cool

plush rapids
#

if you have rented a website you can put stuff on it

charred quarry
tulip patrol
#

I don't understand a single piece of info after that

charred quarry
tulip patrol
#

okay see u in a few days

#

i shall make my bird fly

charred quarry
#

Feel free to come back and ask more questions if you need it

old goblet
dreamy juniperBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.