pygame

Python problems with game

。_饼干妹妹 提交于 2020-01-17 14:52:08
问题 I'm really close to getting my game done, just add the bullets and destroy enemies when they are shot, however, when I run python, the program complains with this error "\Dodger.py", line 180, in bullets.remove(bullet) NameError: name 'bullet' is not defined." I know what an undefined error is but I don't know what kind of definition should I add to get the program to work, Here's the code: import pygame, random, sys from pygame.locals import * TEXTCOLOR = (0, 0, 0) FPS = 60 BADDIEMINSIZE = 8

Can't install pygame_sdl2

故事扮演 提交于 2020-01-17 07:08:51
问题 I'm creating a tower defense game using python and pygame. I would like to add this one on the Google Play Store, but I need to create an apk file. I'm following a tutorial on GitHub: https://github.com/renpytom/rapt-pygame-example. I follow all the instructions but can't install pygame_sdl2 . I use the command prompt, and use $ python setup.py install in the appropriate directory. But it gave me this error : C:\Users\gomes\Downloads\pygame_sdl2-master>python setup.py install Traceback (most

Python cross platform compatible multi screen screenshot

情到浓时终转凉″ 提交于 2020-01-17 05:44:08
问题 Python interpretor used: 2.7 (having trouble with python3.5 py2app on OSX 10.11 I am working on an interesting screenshot app using python and pygame but i am stuck at 1 screen limit since pygame doesn't seem to implicitly support multiple screens. My problem is that right now I use pyautogui screenshot function to capture the whole screen and i open it in a pygame fullscreen window where i can modify the image and such. I would like to know if there is a way to screenshot multiple displays

Open a new window with pygame [duplicate]

一曲冷凌霜 提交于 2020-01-17 04:57:06
问题 This question already has answers here : Pygame level/menu states (2 answers) Closed 10 months ago . I am making an arcade style game where if a player sprite collides with an enemy it should close the game screen and execute the Game over screen.py file which is the script for the Game Over Screen as the name suggests. My code which I used to try and do this is as follows: def sprite_collide(): global p_rect global e_rect if p_rect.colliderect(e_rect): execfile('Game Over Screen.py') I have

AttributeError: NoneType object has no attribute 'health'

人盡茶涼 提交于 2020-01-17 04:08:14
问题 I get this error during a lengthy match in my strategy game, Table Wars. It seems to occur whenever there are many units on the battlefield. Here is the traceback: Traceback (most recent call last): File "C:\Users\Oventoaster\Desktop\Games\Table Wars\Table Wars.py", line 727, in <module> main() File "C:\Users\Oventoaster\Desktop\Games\Table Wars\Table Wars.py", line 131, in main RedTeam.update() File "C:\Python27\lib\site-packages\pygame\sprite.py", line 399, in update for s in self.sprites()

Why isn't my pygame display displaying anything?

て烟熏妆下的殇ゞ 提交于 2020-01-17 02:51:05
问题 I am working on a program that evolves creatures over time using a genetic algorithm. However, for some reason, my pygame display stopped working and I have absolutely no idea why. When I run the program, the window opens but then it just sits on a black screen. I have tested to see where the program gets to and about 38 creatures die then nothing happens. However, these creatures should be displaying before their deaths also, but they aren't.Any help would be wonderful! Thank you for all

Which approach for making Cozmo's expressions in a graphical python application?

风格不统一 提交于 2020-01-17 01:44:26
问题 I have this idea, in which I'd like to animate a pair of robot eyes, similar to Anki's Cozmo, but instead of displaying on a LED screen, I would like to run this in a python application, while still have a similar feel/effect (slight flickering, look pixelated). The problem here is that I have not a clue where to start. Must I have all the animation sprites for all the expressions (sad, happy, angry...) and transitions, then using tkinter or pygame. Or can I just draw directly from a set of

Is there a way to receive inputs from xbox controller triggers, in pygame?

别说谁变了你拦得住时间么 提交于 2020-01-16 12:03:20
问题 A while back I started to control a game I am working on in pygame, with two xbox one controllers. I was doing so on a mac operating system and the controllers were being connected to my computer via the usb to micro usb cables, or specifically, not through Bluetooth. Pygame was able to read each input, with the two triggers being identified as their own axis, so when I returned x = joytsick1.get_numaxes(), print(x) I got 6. However with the recent update to Catalina, and the support for

Is there a way to receive inputs from xbox controller triggers, in pygame?

左心房为你撑大大i 提交于 2020-01-16 12:03:09
问题 A while back I started to control a game I am working on in pygame, with two xbox one controllers. I was doing so on a mac operating system and the controllers were being connected to my computer via the usb to micro usb cables, or specifically, not through Bluetooth. Pygame was able to read each input, with the two triggers being identified as their own axis, so when I returned x = joytsick1.get_numaxes(), print(x) I got 6. However with the recent update to Catalina, and the support for

Is there a way to receive inputs from xbox controller triggers, in pygame?

江枫思渺然 提交于 2020-01-16 12:02:18
问题 A while back I started to control a game I am working on in pygame, with two xbox one controllers. I was doing so on a mac operating system and the controllers were being connected to my computer via the usb to micro usb cables, or specifically, not through Bluetooth. Pygame was able to read each input, with the two triggers being identified as their own axis, so when I returned x = joytsick1.get_numaxes(), print(x) I got 6. However with the recent update to Catalina, and the support for