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
1
vote
2 answers

Creating Game with Python: How to add game menu?

I create a little game. I want to add a little Menu (START, QUIT, CREDITS). When the user clicks START the menu should disappear and the game should start. When the user clicks CREDITS a new screen with the credits should appear (see screenshot). I…
siclaro
  • 137
  • 13
1
vote
1 answer

pygame zero - moving graphics downwards

A graphic should fall at a random position from top to bottom. When the graphic has fallen down, and has "disappeared" from the screen, it should fall again at a random position from top to bottom. I always get the following error message: "empty…
siclaro
  • 137
  • 13
1
vote
1 answer

on_mouse_down called for every button (even scroll wheel movements)

I am using pgzero for implementing a game and have found out that the on_mouse_down hook function is even called when I move/roll the scroll wheel. This is surprising. How can I prevent this? import pgzrun import pgzero def on_mouse_down(pos): …
R Yoda
  • 8,358
  • 2
  • 50
  • 87
1
vote
0 answers

Unable to lower FULLSCREEN resolution in pygame on PI Zero W

I am running Raspbian (buster) at a desktop resolution of ie: 1920x1080 on a Raspberry PI Zero W but wish to create a python game using pygame that runs FULLSCREEN at a lower resolution. I am unable to change to a lower FULLSCREEN resolution and…
user1200233
  • 333
  • 1
  • 2
  • 9
1
vote
1 answer

How do I install pygame zero in my computer? I am getting error, and cannot find another way

I am getting an error installing pygame zero on my computer. I already have python 3.6 32 and 64 bit installed on my Windows system. The 32 bit version was installed with Canopy, I believe. Later, I installed the 64 bit version from the python…
1
vote
1 answer

Pygame libpng warning

When I run my pygame program, an error saying 'libpng warning: Interlace handling should be turned on when using png_read_image' keep happens. Although it doesn't seem to affect the program, I don't like seeing it. I saw the answer saying 'convert…
jwoojin9
  • 295
  • 1
  • 5
  • 16
0
votes
0 answers

Pygame Zero Importing a script into another

I created a game in Pygzero from a Tutorial this code works fine i cut many of the lines import pgzrun import random from pgzero.builtins import Actor, animate, keyboard, clock RASTER_BREITE = 16 RASTER_HOEHE = 12 RASTER_GROESSE =…
0
votes
0 answers

How to make an explosion in pgzrun python?

I'm trying to make an explosion in Python by pgzrun. Note that my files are in the right folders This is my code: from pgzrun import * from pgzhelper import * from random import * TITLE = "title" WIDTH = 600 HEIGHT = 800 level = 1 lives = 3 score…
0
votes
2 answers

Is there a way to change volume of sounds in Pygame Zero?

I'm working on fully fleshing out a game I made following a tutorial, and have been trying to incorporate sound effects into the finished thing. However they are way too loud and I can't seem to find a way to quieten them. I know there's a way in…
0
votes
2 answers

How to color a single pixel in pygame zero

I can't and don't want to know how to use images in pygame zero. I thought of an alternative by making a spritesheet with the def function. I can't figure out how to color a pixel in a specific position though :/ I don't really know how to do it,…
31schral
  • 1
  • 1
0
votes
0 answers

Trouble switching from intro screen to first level

I have basically created a "Maze" game in pygame (or at least tried to). The game has 3 levels with a game sprite and collectable stars that add to the "score" of the game. The player also has 3 lives, and once the player collides with a wall, they…
0
votes
0 answers

i cant make a cooldown on a CPS variable

Here is the code: def update(dt): global puan,cps clock.schedule(cps, 1.0) puan += cps here is the variable: cps = 0 I tried making it increase puan variable by 1 every second but it ignored clock.schedule and its increasing it…
clq
  • 11
  • 1
0
votes
1 answer

I cant increase clickpower variable on my game

So i tried to make an clickpower variable on my game. I tried making these: clickpower = 1 And the part where you buy an upgrade and increase your clickpower by 1. if upgbutton.collidepoint(pos): if puan >= 10: …
clq
  • 11
  • 1
0
votes
0 answers

Getting the string index of player.collidelist

I am coding in Pygame Zero. I wanted to get one of the string index of player.collidelist I have tried using actoer= player.collidelist[57]+player.collidelist[58]+player.collidelist[59] print(actoer) But an error tells me that method object is not…
Azbojrn
  • 1
  • 1
0
votes
0 answers

Get the name of Actor who collided with another actor

I am trying to make a simple game with a square going up and down in Pygame Zero, but I couldn't use any if statements. I am wondering what alternatives do I have for if player.y>downLimit or player.y
Azbojrn
  • 1
  • 1