Questions tagged as 'pygame'

2
answers

Is it good practice to always manage errors with exceptions?

I'm creating a game with Python 3.4 and Pygame, and I'm using the object-oriented paradigm. In my classes, especially in __init__ , I'm full type checkings , to prevent runtime errors. For example, this is my class Board...
asked by 09.12.2014 / 01:22
1
answer

Losing image quality when resizing in pygame

I have some card images in size 140x190 and I'm using the pygame.trnasform.scale method to resize to 105x143 which is a proportional value. But it is losing quality, whereas the images of verses that are basically a background color and a...
asked by 28.10.2017 / 16:06
1
answer

Attraction of objects in python

I'm writing a code where one image goes towards another one that for some reason is not working. I take the distance between them by calculating the force of gravitational% with% of attraction between them and decompose the resulting vector i...
asked by 08.05.2015 / 22:03
1
answer

Coordinates of a PyGame image

How can I get the x and y coordinates of an image in PyGame? I need this for a game where I have to get the shot right out of an enemy. Here is the code: # -*- coding: cp1252 -*- import sys import random import pygame print pygame.init() #ini...
asked by 25.09.2015 / 21:31
1
answer

MP3 player with Python

I do not know almost anything about programming and so I've been studying new possibilities, like POO and the like. Recently it gave me a willingness to try to learn Graphical Interface and also to create an MP3 player, all this in Python (all y...
asked by 10.05.2017 / 16:38
1
answer

Is it possible to create 3d games with pygame?

Is it possible? And if it is possible do I need to know how to draw my own 3D images or is there a site that offers free 3D images?     
asked by 25.10.2017 / 13:53
1
answer

Error: "illegal target for variable annotation" using "@property"

Because pygame does not have a library-like function SFML - > View , I'm developing a "camera" format to scroll the screen and preserve the positions of the objects within the general coordinate within the "world". As default for...
asked by 02.10.2018 / 23:53
1
answer

How to pass keywords arguments in python in a simpler way?

I'm trying to create the button class and trying to get the arguments that I can pass pro rect, so if any argument is None and I pass for example self.rect = pygame.Rect(x=x) and x is None of the error, then I'm doing so: if x:...
asked by 01.12.2017 / 15:57
1
answer

Python - MP3 Libraries

I'm doing a project based on the Python language and it requires good performance in Audio (MP3) playback. Currently I'm using PyGame with its pygame.mixer.music to be able to play the songs, however this lib is very weak and reclu...
asked by 12.05.2017 / 18:39
2
answers

TypeError: 'float' object has no attribute 'getitem'

First, as soon as the mouse is clicked, it saves itself in the bullets_array list the angle of the shot (which is the same angle as the player). Second, speed is given to the shot through the 'cos' and 'sin' and then its movement is limited to a...
asked by 16.02.2015 / 17:03