Python is a dynamically and strongly typed programming language that encourages readability.

learn more… | top users | synonyms

0
votes
0answers
17 views

Generating Triangles and Convex Hulls from concave polygons with holes [on hold]

I'm looking for something like polypartition https://code.google.com/p/polypartition/ that I can chuck a 2d polygon at and get back a set of convex hulls, for physics, and a set of triangles for ...
3
votes
1answer
108 views

How can I tell if an object in a tile grid is surrounded?

I'm making a game which uses a 10x20 matrix to store the position of the objects. I have a castle object, represented by a number in a matrix. It is randomly deployed in some cell of the matrix. I ...
0
votes
1answer
48 views

Rotating an image in Python

So I am making an "Asteroids" like game and I can principally get my sprites image to rotate but when I do, the image gets kinda torn apart. This is the method I am using for rotation. Any help would ...
0
votes
0answers
16 views

Movement Algorith in 2D [duplicate]

I'm making a game in a 600x600 screen. When i click the mouse, i want to move object from an (x,y) position (pre-determinated) to the (x,y) of the mouse. I'm having some problems finding and ...
1
vote
1answer
33 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
0answers
21 views

Pygame Displaying Text Without Pause

I'm creating a rpg game with python and pygame but I ran into a problem. From the videos I learned pygame (not python, learned from univeristy) this is how they told me to display texts. def ...
1
vote
2answers
67 views

Implementing monte-carlo tree search in a tile based game with units

I have this simple risk-like game I would like to develop an AI for. Players move their Units on the map and a simple fight resolution is done. There is a time constraint of 100ms for each round, the ...
0
votes
2answers
45 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
53 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 ...
0
votes
1answer
124 views

How do I make a sprite collide with walls in pygame?

I've been trying to create a collision detection between the player (Blue), and the walls (Green), but the player can just move through the walls. I made it so that every collision is printed in the ...
0
votes
1answer
41 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
59 views

Oblique launch within a game

I'm creating a simple game in python that will follow the same logic of DDTank and Worms. The graph is formed by characters. The buildings that will be destroyed are formed by '*', players are '@' and ...
5
votes
1answer
570 views

What's the 'proper' way to get unit vectors?

My apologies if I've misunderstood the term 'unit vector' or misapplied it in concept, but I think that is the term for an object's heading when expressed as [x, y] when x and y are a value between -1 ...
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
43 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 ...
1
vote
1answer
176 views

Best practice to implement persistent data when using Tiled TMX map files?

A friend of mine and I are always talking about our current progress in learning game development. Recently, saving the game (data persistence) came up, and when I summarized how I tackled that for my ...
3
votes
1answer
523 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.
1
vote
1answer
114 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
91 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 ...
3
votes
1answer
155 views

game mod security question

So I'm in the process of building a game in C++ for the engine and Python for behavior and moddability. One of the planned major features is that when the game client connects to a game server with ...
0
votes
1answer
179 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
107 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
57 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
351 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 ...
1
vote
2answers
180 views

Best way to store a large amount of game objects and update the ones onscreen

Good afternoon guys! I'm a young beginner game developer working on my first large scale game project and I've run into a situation where I'm not quite sure what the best solution may be (if there is ...
0
votes
1answer
80 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, ...
-1
votes
1answer
143 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
138 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 ...
0
votes
1answer
77 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 ...
0
votes
0answers
14 views

How do I distribute my game with Py2exe or PyInstaller? [duplicate]

I just developed a game with Python and I want to use Py2exe and Pyinstaller to turn it into a stand-alone python file or .exe that can run on computers without python installed. How can I do this?
2
votes
1answer
510 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
83 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
45 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 ...
0
votes
0answers
120 views

How to rotate a line in 3d space?

I am trying to figure out direction vectors of the arrowheads of an arrow. Basically I'm given a normalized direction vector (u,v,w) and I need the normalized direction vectors of the its two arrow ...
1
vote
1answer
62 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
0answers
61 views

How to find the Y coordinate of a line moving up and down with given specific X coordinate?

I start with a horizontal line and I run midpoint displacement algorithm to generate some mountains, then I want to place some pillars on top of the mountain by randomly choosing the X coordinate, but ...
0
votes
1answer
114 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
53 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
102 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 ...
0
votes
1answer
146 views

Player & Level class structure in 2D python console game?

I'm trying to create a 2D console game, where I have a player who can freely move around in a level (~map, but map is a reserved keyword) and interfere with other objects. Levels construct out of ...
1
vote
0answers
104 views

Speeding up point-in-polygon for Python

In researching collision detection methods for non-Rect-like objects I came across point-in-polygon -- specifically, the even-odd rule. The one presently on Wikipedia claims it is written in Python, ...
0
votes
1answer
151 views

How do I pass an object location into a vertex shader?

I am using Blender Game Engine. I want to create a large flat plane, and deform it locally near a moving object. So far (despite being a beginner at shaders) I've written a vertex shader for the ...
0
votes
1answer
68 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
162 views

Picking random monster cards from a deck

What is the best way to go about making user defined classes (monsters, items, loot, armor, weapons, spell types, etc) and then calling them later during an encounter? Looking at the entire card list ...
2
votes
1answer
68 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 ...
3
votes
1answer
109 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 ...
0
votes
1answer
339 views

Texturing a PyOpenGL 3D Cube with PySDL2

So, I've just started learning OpenGL with PySDL2, and I've created a class that will create a cube to the window that I've created with PySDL2. What I'd like to do now, is to figure out a way to ...
3
votes
1answer
179 views

Directional, Triangular Collision Detection in Pygame [duplicate]

I am trying to create a game in Pygame, with Python 3, and am trying to figure out an algorithm that will tell me which direction a rectangle is colliding with a rectangle, so that I can push it back ...
3
votes
1answer
245 views

How do I efficiently render the tiles of a tile map?

I've been working on a game, and I've been using Python with Pyglet to create it. I had an issue on how I could do effective tile based rendering. I tried cocos2d, however the API is very efficient ...
1
vote
2answers
444 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 ...