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
2
votes
1 answer

Function is Repeating Ten Times Instead of Once - Pygame Zero

I have written a simple racing game in Pygame Zero. This comes from the MagPi "Retro Gaming with Raspberry Pi" Book. I am a beginner programmer so I might be asking an obvious question. I want to make levels. For every 100 score, level + 1. Win at…
user12701531
2
votes
2 answers

pygame - How to finish game?

I am creating a litle game. When the user reaches 100 or more points the game should stop and a new screen should appear. I tried it, but it is not working. The game don't stop and the screen "flickers". How can i finish game and "make" a new…
siclaro
  • 137
  • 13
2
votes
1 answer

How to I make the actor jump without stopping the entire code?

I am attempting to make the dino jump, but when I use time.sleep(0.1) in between the dino jumping and falling, the whole game stops for 0.1 seconds. I have tried using time.sleep and that's it as I can't find any other useful info online. def…
Centr1fuge
  • 47
  • 5
2
votes
1 answer

Center window of a Pygame Zero game

I am using the easy-to-use Python library pgzero for programming games. How can I center the game window? )It always opens at a random position... import pgzrun TITLE = "Hello World" WIDTH = 800 HEIGHT = 600 pgzrun.go() Note: I am using the…
R Yoda
  • 8,358
  • 2
  • 50
  • 87
1
vote
1 answer

How to fix my Pygame Zero incomplete background error

I am trying to complete a a python course (beginner) and I'm trying to make a game using pgzero. The problem I am encountering is that the background is not loading correctly i.e. the size of the window and the background are not matching and part…
1
vote
1 answer

How can I implement on_mose_move method in pgzero?

So I'm trying to write a simple Arkanoid game, using only pgzero (!not pygame), and I want my paddle to move not using my keyboard, but using my mouse, so that the paddle moves left or right following the cursor, how can I do that and how to…
maksonios
  • 15
  • 4
1
vote
1 answer

animation loop only cares about first item in list

In a simple pygame zero 2D game, I have a list of Actors that I'm looping through to ensure that they don't run off the side of the screen. However, going right, only the leftmost item in the list (the first one) is triggering the direction…
beachCode
  • 3,202
  • 8
  • 36
  • 69
1
vote
1 answer

How do I make it so that it doesn't input more than once?

if keyboard.h and start == False: start = True print("hello?") dotty_move() if keyboard.h and start == True: start = False print("bye") dot1.pos = x, y dot2.pos = xi, yi def dotty_move(): …
Whi_24
  • 41
  • 4
1
vote
1 answer

Making a Bullet move towards a Target without following the Target using Pgzhelper in Pygame Zero

Question: How can I make a bullet move towards a target without following the target using Pgzhelper in Pygame Zero? I wanted to share this with a lot of people that may have the same trouble using Pygame Zero: The problem may stem from people…
1
vote
1 answer

What makes PyGame Zero an API?

I'm trying to understand what an API is. Consider the special case of PyGame Zero, which is an API. Wikipedia says that an api is a way for two or more computer programs to communicate with each other. What are the two (or more) programmes that…
Nik
  • 21
  • 4
1
vote
0 answers

Stuck on how to make text appear as "assets" enter circle

Making a small game through pygame zero. trying to get text to appear on "assets" as they enter the circle. Have tried different methods with rect but end up with errors. This is apart of my code. Have been using Pygame-zero to try and work through…
GATORSSSS
  • 11
  • 1
1
vote
1 answer

Adding a text input field in PyGame Zero?

Is it possible to add a text input field into a Pygame Zero game? I can't see it in the docs but may have overlooked it.
PlantPot
  • 49
  • 6
1
vote
1 answer

How can I export Pgzero (pygame zero) to .exe?

I am just wondering how can I make an executable from pgzero game. I have tried for hours with no success. pyinstaller always had some errors during exporting, or opening .exe . Or exe file did nothing after opening (and I also have tried waiting…
1
vote
1 answer

Fuel cans not showing up

I'm programming a game in Python 3.7 using the module Pygame zero. The name of the game is "Road rage". I'm trying to make fuel cans showing up on he road to collect them, but for some reason they're not showing up. I've tried to print out how many…
Henryk
  • 11
  • 1
1
vote
3 answers

Problem with the smoothness of the fly's movement

I'm learning programming and trying to write my own simple pgzero game. Attempts to make a smooth fly movement in def update (): to random coordinates. Tried animate, unfortunately failed, ended up using randint and time.sleep (1). The fly jumps…
Slavo Heys
  • 33
  • 5