Questions tagged [pygame]

Pygame is a set of Python modules designed for writing video games. Use this tag only if you are using the Pygame library and not if you have a question about programming a game in Python in general.

Pygame is a free Python library released under the Lesser General Public License (GNU LGPL) version 2.1 (according to its GitHub page), aimed at creating video games. It's built on top of , is highly portable and runs on nearly every platform and operating system.

References

Documentation

Games using Pygame

19430 questions
3
votes
1 answer

pip install pygame on ubuntu 18.04 using pyenv/python 3.7

I've got python 3.7.0 installed on ubuntu 18.04 using pyenv and I'm trying to install pygame using pip. My procedure is:- sudo apt-get build-dep python-pygame pip install pygame The last step keeps giving me:- peter@Brian:~$ pip install…
user1062524
  • 63
  • 1
  • 5
3
votes
1 answer

How to make multi-keystroke function in Python

I'm using Python 3.5 and I want to make multi-keystroke function. I want to make a function that notices Ctrl+Q but my program didn't notice it. Here's my code: import threading, pygame from pygame.locals import * from time import…
Hoseong Jeon
  • 1,240
  • 2
  • 12
  • 20
3
votes
1 answer

Pygame: Making things move slower than 1

I made a little Space Invaders like game, everything is good except that I feel like my enemies I programmed move too fast. If I make their movement speed under 1 such as 0.5, they won't even move. Is there a way I can make the movement even…
3
votes
1 answer

Non colliding objects which has Colliding Pairs, Pymunk Pygame

I would like to implement a code which has non colliding pairs with colliding objects. My pairs are 2 balls which are connected to each other. I want those 2 pair ball to collide. However I don't want those 2 balls to collide with other pairs. How…
Meric Ozcan
  • 678
  • 5
  • 25
3
votes
1 answer

Keyboard input in Pygame not working

I'm trying to create a virtual synthesizer with pygame and some other libraries. The note can be played in two ways: by clicking a button on the screen or by pressing keys on the keyboard. The keyboard input does not work while clicking on the…
3
votes
3 answers

Pygame, Collision between 2 objects in the same group

So, i am trying to create a game where aliens spawn from 3 specific places. Each Alien will spawn randomly in one of the 3. But there will always be at least one alien, that will spawn on top of another one. I want to delete that alien and spawn him…
3
votes
1 answer

Make drawings in pygame

I have a dict of numbers (prices exactly)/each month: {'2018-05-26': Decimal('7334.1638'), '2018-05-27': Decimal('7344.9675'), '2018-05-28': Decimal('7105.6725')} I can easily plot this using plotly and the plot looks like this: I want this graph…
user6476414
3
votes
2 answers

How to draw a continuous line in Pygame?

I want to draw a line when mouse clicked and moving in Pygame framework, it will be a line if I move the mouse very slowly. However, if I move the mouse quickly, it's just incontinuous dots. The question is how to draw a continuous line when mouse…
Jimmy
  • 45
  • 1
  • 7
3
votes
1 answer

Detect both CTRL simultaneously in pygame

I try to detect if both CTRL is pressed simultaneously import pygame pygame.init() screen = pygame.display.set_mode((100,100)) run = True while run: for event in pygame.event.get(): if event.type == pygame.QUIT: run =…
Zoltan
  • 533
  • 4
  • 18
3
votes
1 answer

How to rotate slices of a Rubik's Cube in python PyOpenGL?

I'm attempting to create a Rubik's Cube in Python, i have gotten as far as visually representing the cube. Struggling a bit with how to implement rotation. I guess i'm asking for feedback as to how to go about doing this. I thought at first of,…
Snuffles
  • 487
  • 6
  • 17
3
votes
2 answers

can't serialized pygame.Surface objects with pickle

I am developing a game with python 3.6, I want in its multiplayer version to send to the server objects modified by the client ( the player) I thought to serialize them for transfer. I use pygame and thus pygame.Surface in my objects I have objects…
patol
  • 136
  • 2
  • 10
3
votes
1 answer

'bool object is not callable' pygame

I am getting a 'bool object is not callable' error when trying to reassign the x and y values of an instance. I don't believe I'm calling on a 'bool' object. The only possibility would be the reassignment of self.selected to False, but I tried…
3
votes
1 answer

Pygame - How do I blit an image but change its color?

I have a program for a random flag generator. I have made a white "background" for a flag, and different symbols etc. which are white. The reason they're white is so I can color it using an RGB value. The problem is, I'm not sure how to do that(if…
Potensa
  • 33
  • 1
  • 3
3
votes
1 answer

How to blit "print" onto screen in pygame

I’ve written a simple RPG battle system where if you input “y” you get to attack but if you input “n” the enemy attacks you. The inputs are temporary until I implement an attacking system but all the of the outputs are being shown in the command…
Moe
  • 191
  • 7
3
votes
3 answers

pygame fullscreen mode exit

I'm running this little program that loads images to the screen in fullscreen mode but once it loads the program will not exit by any key combination and I end up having to reset the computer to complete whatever else I was doing. import…