Questions tagged [pgzero]

pgzero (Pygame Zero) is a Python library providing a zero-boilerplate game development framework. It is based on another third-party library named pygame.

pgzero (Pygame Zero) is a Python library providing a zero-boilerplate game development framework. It is based on the library pygame.

PyPi: https://pypi.org/project/pgzero
Source code: https://github.com/lordmauve/pgzero
Documentation: https://pygame-zero.readthedocs.io

104 questions
0
votes
1 answer

pip3 install pgzero --- leads to command '/usr/bin/gcc' failed with exit code 1 (Python 3.9; macOS 10.15.7)

I try to learn python right now and one of my projects include writing a small game. to write the game I need pgzero. I can install pygame but as soon as I try to install pgzero it allways ends with an error code. Full Error Code below I already…
Tr1x1
  • 1
  • 2
0
votes
1 answer

Pyinstaller Unable to access Data Folder

Below is the game.spec file that I have created. When running the below command, the app gets created perfectly pyinstaller --onefile game.spec When operating the game, it is unable to locate any of the datafiles. On further exploration found that…
Sunil Nair
  • 51
  • 2
  • 8
0
votes
0 answers

Images will not show in GitHub README.md even after using GitHub Documentation

I can't find any information on why I am getting these weird errors. I followed GitHub's documentation when trying to implement some screenshots of the pygames I built into the README by using: Format: But when I do this the all that shows up in…
wisenickel
  • 346
  • 4
  • 16
0
votes
2 answers

Why is an integer variable used in an if statement?

In the following code snippet next_dot is used in an if statement, why? def on_mouse_down(pos): if dots[next_dot].collidepoint(pos): if next_dot: lines.append((dots[next_dot - 1].pos, dots[next_dot].pos)) next_dot…
0
votes
1 answer

Character Animation happens very fast

Please find below code using the PyGame Zero Library The character animation in the function trex_move() happens very quick despite applying clock.schedule. The animation, therefore, does not look natural. Is there any way to slow down the…
Sunil Nair
  • 51
  • 2
  • 8
0
votes
0 answers

Pygame Zero: Different background images for different level possible?

I am creating a small game with python and pygame zero. In the game i like to use different background images for different level. So, if the user reaches level 2 a new background image should appear. Is this possible. I tried this, but i always get…
siclaro
  • 137
  • 13
0
votes
1 answer

Pygame Zero: Creating multiple level

I created a game with Python and Pygame Zero. When the user reaches 200 points a screen appear with a button appear. When the user clicks the button (next level) a new level should appear. I try to managed this with gamemode = 3 and gamestart = 1…
siclaro
  • 137
  • 13
0
votes
2 answers

Pyinstaller - Error Message: name Actor is not defined

I created a small game with Pygame and MU IDE. Then I wanted to convert the .py file to a .exe file with pyinstaller. It was no problem to create the exe file. But if I want to execute the created exe file I get the following error message: 'name…
siclaro
  • 137
  • 13
0
votes
1 answer

How do I 'aim' an image at the mouse?

I'm starting out with python, I only know the basics and I want to create a top-down type of game to the one I have currently. I've tried some solutions on the internet and sadly, none of them has worked for me. As I said, I can't find a working…
-1
votes
1 answer

Can you connect a controller to Pygame Zero?

I have programming as a subject in school, and this is our last project of the semester. For our last task we are going to use replit.com, which use PygameZero. Which from my understanding, is a easier version of Pygame, which again is a version of…
TogiTogi
  • 3
  • 2
-1
votes
2 answers

How to stop the sound in pgzrun (Pygame Zero) when my game ends?

the sound plays right now for eternity and I only want it to play once when the game ends. I've looked it up everywhere but I really cannot find any good and helpful solution to this problem. I use pygame zero. Here is my code for my game: import…
I_code
  • 1
  • 1
-2
votes
2 answers

How to add wrapping in pygame/pygame zero

If you can I would like the wrapping to be an add-on to the code I have already, as this code I know works seamlessly and smoothing going from one side to the other. Basically the code I have allows wrapping from the bottom side to the top and from…
Whi_24
  • 41
  • 4
-2
votes
1 answer

Is there a way to play background music in python pgzero?

I currently have an audio file in the correct directory but I can't seem to find a command that will play and loop the song. Is it the same as just playing the sound? If not, what is the syntax to play the music?
-3
votes
1 answer

Character movement in Pygame Zero

As of right now, my character moves whilst I'm holding my key down. e.g. if keyboard.left: actor.x -= 5 However, I would like my actor to move in a sort of block-ish fashion e.g. I press my key once and it moves to the left by 5 pixels,…
siip
  • 3
  • 1
1 2 3 4 5 6
7