Game development software based on the Python programming language.
0
votes
0answers
23 views
Load Images in Pygame with XML
As the title suggests, I'm trying to find a way to load images in Pygame with xml, but my attempts have given me naught.
XML script:
<Creatures>
<Creature>
...
2
votes
1answer
93 views
How can I support multiple player inputs in Pygame?
I'm trying to develop a team-based Asteroids game. It's going well except for the "multiple user inputs to a single machine" part. Can anyone recommend a method for getting and updating 6 players ...
1
vote
1answer
41 views
Playing a sound once pygame
I'm trying to play background music and the music keeps on starting. I tried to use music.busy, but I can't figure it out. I want it to check if sound/music is playing, then I want it to print "music ...
0
votes
2answers
47 views
Getting a color value from a coord
My goal is to get a RGB value of a pixel based of off a X,Y coordinate.
I have been working on AIs for a small project attempting to make a bot that can pass through a maze. I want to get the pixel ...
0
votes
1answer
69 views
Color detection
Is there a way to tell if a sprite is touching a specific color on the screen, maybe in a hex code. I know you can do $pygame.sprite.collide$ for sprites, but how can you do this for color on the ...
1
vote
1answer
113 views
How to remove the old sprites in pygame and show them at a different location
I am trying to show the motion of some basketballs towards walle using the pygae sprites. The idea is that I don't know how to remove the old ones so they won't show. Is there a move method so that it ...
0
votes
1answer
42 views
How to change the position of a circle in pygame in three stages
I will try to explain it as well as I can excuse me if I'll fail. I have the following simple game situation:
I know the coordinates of each point. So each of the green points try to hit the blue ...
0
votes
1answer
43 views
Efficiently tracking active instances
I'm creating a game with lots of instances. On each iteration of the game loop, I only want to deal with the ones that are near the player. Currently, I do this by constructing a list of all the ...
0
votes
0answers
57 views
pygame.display.update(list) updates entire screen, not just rectangles in list
I have two "sprites", one following the mouse and one that moves with WASD. They aren't really pygame.sprite.Sprite objects, but they move like this:
Paint over original position with that piece of ...
3
votes
2answers
556 views
Any way to embed Pygame in webpages?
I have a Pygame game, and I was wondering if there was any way to embed it into a webpage to make it easily playable, or if there is a games website that accepts Pygame games.
EDIT: I am now using ...
0
votes
0answers
42 views
putting view 'effects' in the view - pygame
I have a project where I've tried to move 'visual effects' out of the sprite class's responsibility and into a 'screen manager' class, and before I get much further than effects like rotation and ...
1
vote
1answer
131 views
Pygame's sprite.collide_circle() missing several frames of head-on collision
I've spent hours trying to figure why my collision detection was so crappy, with sprites visibly ovellaping for several frames, when I noticed the culprit could be pygame's detection callback ...
0
votes
2answers
120 views
Pygame Surfaces: which (and when) do I need to .convert()?
I'm a bit puzzled about pygame's Surface.convert():
It's common sense that I should convert a surface after loading an image to it (presumably a jpg/png/etc file), but what about surfaces that I ...
1
vote
1answer
174 views
Pygame Scrolling Map
I have two questions.
I'm working in a rogue-like and I've manage to implement a camera on the player, the camera shows just the players surroundings and is fixed in the side of the windows.
The ...
0
votes
1answer
198 views
Chess Artificial intelligence with python and pygame [closed]
I created chess game with python and pygame. Now I'm trying to make Artificial intelligence, but what is actually best way to do it? Some tips, tricks, links?
Thanks
1
vote
1answer
119 views
Splitting Pygame functionality between classes or modules?
I am attempting to make my pygame application more modular so that different functionalities are split up into different classes and modules.
I am having some trouble getting pygame to allow me to ...
0
votes
1answer
59 views
Possible to pass pygame data to memory map block?
I am building a matrix out of addressable pixels and it will be run by a Pi (over the ethernet bus). The matrix will be 75 pixels wide and 20 pixels tall. As a side project, I thought it would be ...
6
votes
1answer
353 views
How do I measure the bounds of a string in PyGame?
I am trying to position some text on my screen using pygame, and knowing the size of the string would help.
When using C# and XNA I could use SpriteFont.MeasureString("Hello World") to get the size ...
0
votes
1answer
86 views
Bounding Box Collision Glitching Problem (Pygame)
So far the "Bounding Box" method is the only one that I know. It's efficient enough to deal with simple games. Nevertheless, the game I'm developing is not that simple anymore and for that reason, ...
2
votes
2answers
297 views
Fade in screen in pyGame?
So I wanted to make my menu fade in when the game starts and fade out when it quits. To do so, I created a second surface and planned to fill it with black and then gradually increase alpha. So in the ...
-1
votes
1answer
168 views
theory behind rotation of a 3d cube using mouse
I want to rotate a 3d cube using mouse in python/pygame. Could someone explain the theory behind rotating a 3d cube by mouse?
I dont understand how angleX, angleY and angleZ are affected by mouse ...
1
vote
1answer
155 views
How do I make a sprite move to another position using vectors
Ok, so far I have made the sprite move to a mouse position. But I got a question, does anyone know how to make a sprite move by itself without the use of a mouseclick from Point a to point b using ...
4
votes
2answers
1k views
Why does my turn-based game loop allow the enemy to act repeatedly?
I'm trying to create a turn-based game in pyGame but hit a wall when trying to properly handle the main game loop. So I have something like this:
def loop(self):
while self.stategame==1:
...
0
votes
1answer
84 views
How to display consistent background image
Drawing a large background is relatively slow in PyGame.
In order to avoid drawing BG every frame, you could draw it once, then do nothing.
However, if something is overdrawn onto the surface and ...
1
vote
1answer
320 views
What does a “video system not initialised” error in pygame mean?
I'm trying to play music when a key is pressed in pygame, then print a message.
When I run this script:
import pygame
import time
pressedkeys = pygame.key.get_pressed()
pygame.init() ...
2
votes
1answer
609 views
Howdo I load a GIF animation in pygame?
How can I load a GIF animation in pygame? With a web search, I found a severely outdated library called GIFImage. I tried it to do it with 2 pictures but I'm getting stuck because I'm a beginner. I ...
1
vote
1answer
91 views
How can I rotate my picture using Pygame?
I wanna make the Dragon on the picture rotate softly to the left when he flys to the left and rotate to the right when he flys to the right and up and down also.
How can i do that with the keys w a s ...
0
votes
1answer
47 views
Pygame proble, moving picture
Thats my problem on the Picture...The stripes
How can i fix that?
My Code:
import pygame, sys
from pygame.locals import *
pygame.init()
sound = pygame.mixer.Sound('start.wav')
sound.play()
size ...
-1
votes
1answer
68 views
How to stop characters running in to each other? [duplicate]
I am new to pygame and am creating a small game in which players can push each other to go outside the given arena to score points. I have a problem in detecting when characters run in to each other. ...
2
votes
1answer
442 views
How do I get hardware accelerated graphics and shaders in PyGame?
I have created several simple games with PyGame, but until now, I have focused on mechanics rather than graphics. The graphics in my games have been extremely rudimentary, consisting of basic shapes ...
1
vote
1answer
63 views
When is messaging/observing preferable to 'built-in' functionality in game objects?
In working on a Python/Pygame project I recently came to an impasse which couldn't be solved elegantly via my previous methodology - using wrapping functions as an Observer pattern - and it was ...
0
votes
1answer
128 views
WebSockets and Python/PyGame
I am looking to start development on a game that will have the server be written in Python/PyGame and the front end be in HTML5. What I would like to do is, with as minimal impact as possible, open ...
0
votes
1answer
55 views
PyGame2Exe doesn't include spritesheet?
My directory for my Pygame program looks something like this:
[Parent directory]
lib
engine
Various .py files
graphics
spritesheet.py
...
1
vote
1answer
114 views
Midpoint Displacement 1D - How to properly reduce my random number range?
So I'm trying to implement this http://www.gameprogrammer.com/fractal.html#midpoint algorithm, to generate myself a terrain.
In the tutorial is said:
OK, before we go into 2D fractal surfaces, you ...
1
vote
1answer
295 views
How can I simulate shadows for a 2D top-down game? [duplicate]
I'm trying to simulate shadows for a 2D top-down RPG (in Python), but I can't think of the best way to do this
So far I've tried making copies of the original game entities and turning all opaque ...
0
votes
1answer
59 views
Rotating image around a given point
Im trying to simulate shadows in a 2d RPG, So far I can make the shadows but i cant blit them properly, Im trying to rotate them according to where the "sun" is (just a position)
I have looked at ...
0
votes
1answer
69 views
How to spin an object on its own axis?
I'm trying to spin up my own 3D vector graphics engine, so I'd like to do this without an existing library. And I don't seem to be able to find the math for the correct approach in rotating an object ...
2
votes
1answer
69 views
Get a random vector
I'm trying to make a small pariticle-like simulation, and I'm trying to make each parrticle go a random direction from one point (mouse pos). The problem is I don't know how to get the random vector ...
1
vote
1answer
109 views
3D vector graphics - maintaining correct Z 'length'
So I'm trying to build myself a 3D display 'engine', or whatever it ought to be called. I've been experimenting with PyGame, as it's familiar to me.
In a way this has almost been more an excuse to ...
3
votes
1answer
111 views
Pygame collision detection less frequent when objects are increased
I currently experiencing an issue in pygame where whenever i increase the number of objects e.g. platforms, rocks
for a in range(150):
rock = Rock(0,0)
OR incresing the range which they spawn ...
1
vote
1answer
159 views
pygame - avoiding sprite 'jitters' on rotating the image
Is there a common trick for getting around sprites that are changing directions 'too quickly' and causing their sprite to display erratically?
In this project, the player moves in 8 directions by ...
1
vote
2answers
471 views
Detecting walls or floors in pygame
I am trying to make bullets bounce of walls, but I can't figure out how to correctly do the collision detection. What I am currently doing is iterating through all the solid blocks and if the bullet ...
3
votes
1answer
293 views
What's the difference between Pygame's Sound and Music classes?
What are the key differences between the Sound and Music classes in Pygame? What are the limitations of each? In what situation would one use one or the other? Is there a benefit to using them in ...
2
votes
1answer
442 views
How to march tiles together like in Terraria?
I've been trying to get tile marching to work like in Terraria, and I got something to work. I don't think it's actually very good way of doing this, so I'm wondering what would be really the main way ...
0
votes
1answer
245 views
Collision detection without classes, in Pygame
I am writing a game in Pygame and want to get collision detection working. The aim is that when an object hits another, the target object disappears. I want to avoid having classes for now, to keep ...
-2
votes
2answers
137 views
Pygame 2d map error [closed]
I'm writing a Legend of Zelda like game in pygame.
I have this code for loading a map from a text file.
#Load maps
f = open ("map1","r")#This file is a text file containing only: 1
map01 = f.read()
...
2
votes
1answer
201 views
How can I get post-processing effects with pygame?
I'd like to be able to make the screen like blurry and wavy, like when a player enters a portal in Minecraft.
How would I make this with pygame?
1
vote
2answers
286 views
Sprite erasing text in Pygame
I'm making a Pong clone in which the user can press the 'p' button to pause/unpause the game. When the user presses the 'p' button the word 'PAUSE' is drawn to the screen and when he presses again the ...
1
vote
2answers
202 views
Monster attack is not randomising right [closed]
I have a code that I've been messing around with and the monster attack (monster.ma)
isn't randomising after the first time it's called upon (elif statement). I've tried to make it a tuple since they ...
0
votes
2answers
258 views
Crossfade Between Two Music Tracks in Pygame
My intention is to have two music tracks, which are similar in nature, fade between each other at various times. When such a fade occurs, one music track should fade from full volume to muted in a ...