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

learn more… | top users | synonyms

0
votes
1answer
21 views

Implement delay using polling or threads?

I'm making a real-time risk-like game in Python. Players can move armies from one region to another. I want army movement to take time proportional to the distance between the two regions, therefore I ...
0
votes
0answers
31 views

Have a 3d point move on HUD depending the direction of the camera

My problem is the following: I'm in the (x, y, z) position and I have several points (xn, yn, zn) and depending of my view direction, assuming I have the angle values for vertical, horizontal and ...
0
votes
1answer
20 views

Pyglet Layout won't render?

Here's some sample code I copy pasted to try and get a Pyglet layout to work. I just get a blank screen. Every time I try to write my own code based on the docs or copy/paste some example code it ...
4
votes
1answer
156 views

How do you create a perfect maze with walls that are as thick as the other tiles?

http://journal.stuffwithstuff.com/2014/12/21/rooms-and-mazes/ I read this article about dungeon and maze generation. The author uses a kind of specialized algorithm for generating 'perfect' mazes ...
0
votes
1answer
56 views

Point inside a large polygon

I am just starting to get into using pyBox2D as I already knew python well and I was wondering if I have 500 points of a large polygon, how would I be able to check if a point lies inside of this ...
0
votes
1answer
90 views

What is the difference between Pygames, Pyglet and Kivy and how each helps python game development? [closed]

I trying to figure out which options would be best to give a graphics to a UNIX based 2D game whose logical part was written in python. Which engine to use. What is the difference between Pygames, ...
0
votes
0answers
32 views

Creating Integers for dice game [duplicate]

i am struggling how to create random integers, the problem im having is if for example 2 dice with say 2 sides is chosen the lowest number rolled by that dice can only be 2 from 1 on both the 2 dice. ...
-1
votes
1answer
47 views

Why does this 'else' throw an error after the 'elif' in Python? [closed]

I am having trouble using the else statement and wont function correctly and will not pick it up as a correct syntax how would I correctly get this to work if invalid input was entered.. condition = "...
0
votes
0answers
25 views

Connecting Unity Phone App to Raspberry Pi over network

I am making a TV remote app with Unity that needs to connect with my RPi 3. Here's an image for reference: Each time I press one of the buttons, I would like the Unity phone app (on Android only) to ...
0
votes
1answer
25 views

Choosing frame rate in PyGame with keyboard input

Using PyGame, I want to create a moving square which moves in a grid, controlled by keyboard presses of the arrows. So, pressing the "up" key moves the square to the cell directly upwards, pressing ...
1
vote
1answer
132 views

Games developed in Python with Pygame lags too much; how can I improve the framerate?

I'm currently working on a very simple RPG game but when I try to load all the tile images for the background, the game lags to the point it freezes (framerate drops to 0 or will just crash). The ...
0
votes
1answer
85 views

Generate Random Integers

I am trying to make a dice rolling game. I want to generate a random integer in the range of the number of dice I have multiplied by the number of sides the dice has. For example, if two dice were ...
5
votes
0answers
48 views

Scoreboard setdisplay list shows correctly per char. Can i make my sidebar show correctly per char as well?

So I've been writing a script over the last little while in Python that interacts with the Minecraft console. I'm basically trying to make a scoreboard based currency system that is world independent ...
1
vote
2answers
71 views

How To Blit an Image onto Only Opaque Parts of a Surface?

I want to blit an image onto the parts of a surface that aren't transparent. I was wondering if there were a quick way to do this in Pygame. I want to be able to add effects to stuff. I know that I ...
0
votes
1answer
40 views

Identify objects of the same type from each other, even between game restarts?

So I have a simple Character class: class Character: def __init__(self, type, level, health, items=None): self._type = type self.level = level self.health = health ...
0
votes
1answer
82 views

Triangle mesh smoothing

I have a grid in terms of two arrays: points: contains 3D coordinates of points. triangles: contains 3 indices per line for each triangle of the grid. I would like to interpolate the grid to make ...
0
votes
1answer
83 views

Three levels deep composition (player<-character<-spell), with preset character+skill sets

So I'm creating a rather generic strategy game similar to Warcraft or League of Legends, which needs to have: a Player class for representing the users playing the game a Character class for the ...
0
votes
0answers
50 views

PyGame Dynamically / On Demand Loading / Unloading Objects

I am having a go at making my own game engine using the PyGame framework and have hit a potential snag and am unsure how to progress Summary I am aiming to create a 2D platformer. To achieve this, I ...
0
votes
2answers
40 views

In Pygame, why does my sprite only move each time the button is pressed?

As quite obviously stated in my title, why does my sprite only move each single time the key is pressed, (as opposed to moving WHILE the key is pressed.) By the way, really sorry, you won't be able to ...
0
votes
0answers
29 views

Arrays in python error

List=[[0, 0, 0, 0, 0, 0, 0, 0, 0],[1, 1, 1, 1, 1, 1, 1, 1, 1],[0, 0, 0, 0, 0, 0, 0, 0, 0]] FullRow=[1, 1, 1, 1, 1, 1, 1, 1, 1] for Index, Item in enumerate(List): if Item == FullRow: List[...
0
votes
0answers
23 views

Pygame Tetris: Appending and removing from Grid

I am creating a game of Tetris using pygame. I have an array for a grid: Grid=[[0,0,0,0,0,0,0,0][0,0,0,0,0,0,0,0][0,0,0,0,0,0,0,0][0,0,0,0,0,0,0,0][0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0]...
0
votes
1answer
20 views

Pygame falling shape and keyboard input

I want a shape in pygame to fall down slowly. The user should be able to move the shape with the arrow keys. My code is given below: while Running: Keys=pygame.key.get_pressed() if event.type ...
0
votes
1answer
30 views

How to only allow letters to be pressed on in pygame?

I want the user to press on any letter of the alphabet; it should block the input from the rest of the keys. How can I do this using pygame? Keys=pygame.key.get_pressed()
0
votes
1answer
119 views

User input text in pygame

I want a text box to appear on the screen. I am doing this by: TextButton= pygame.draw.rect(Screen,Red, (100, 100, 150,50),2) How can I allow the user to enter a text into this text box in Pygame? ...
1
vote
1answer
26 views

Pygame array; keeping list items constant

I have an array in python(pygame): Grid=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]] I have written a program that changes some of the values of the array to 1 if certain variables are true. ...
-1
votes
1answer
42 views

Pygame moving rectangle

I am coding a snake game with pygame for Python 3.6 and wonder how I can make the snake move all the time, changing direction when buttons right, down, left and up pressed, like in the real snake game....
0
votes
1answer
78 views

Too slow for cycle in Pygame

I'm using Pygame for Python 2 and I have the following code: self.radius = 100 self.light = pygame.Surface((2*self.radius, 2*self.radius), pygame.SRCALPHA) self.light.fill((0, 0, 0, 0)) pygame.draw....
0
votes
2answers
46 views

Clearing screen in Pygame so content on the screen is not lost, but updated

I am creating a Tetris game using Pygame. It generates a random shape from a list and draws it onto the screen. However, when the arrow key is pressed by the user, it draws the shape again without ...
0
votes
1answer
26 views

Converting array to shape drawn: Pygame

screen=pygame.display.set_mode((500, 700)) Shape=['.....', '..O..', '.OOO.', '.....', '.....'] ShapeProperites={'x': 250, 'y': 50, 'Color':...
1
vote
2answers
216 views

Breakout angle calculation

I am making my first game in python and I am really stuck at with a physics problem. The game I am trying to make is a copy of the game Breakout. In Breakout, the player controls a "paddle" at the ...
1
vote
1answer
288 views

Pygame Collide Rect

Currently making a maze game. Maze is drawn, everything is drawn with pygame.draw.rect. I have tried using pygame.coliderect() to check for colisions, but it isn't working. The current error message ...
0
votes
0answers
138 views

Zebra puzzle generator algorithm

I made an open source zebra puzzle generator, also known as an Einstein puzzle. When I generate a table, I have to obfuscate (make obscure) it, and make some letters hidden with the good indication ...
1
vote
1answer
189 views

Pygame, how can I move a rect/sprite from point A to B smoothly?

As the title suggests, i want to move a rect/sprite from point A to point B in a smooth manner. What I mean more specifically is that the speed of the movement should change throughout the course. So ...
0
votes
1answer
103 views

Creating a 3rd Person Flying Camera for 3D asteroids game

In order to learn PyOpenGL and test out an engine I am developing, I am trying to write a 3D asteroids flying space shooter game. Currently, I am implementing the camera using a "look at" function ...
-1
votes
1answer
59 views

How to update everything but 1 thing in pygame and python

What I'm doing So I'm developing a game for my Computer Science final with python & pygame. It's done other then I have to make a main menu. I've been developing it over the last 2 weeks because ...
0
votes
1answer
76 views

How do I create a maze without drawing each individual line or using sprites?

I am currently trying to create a maze game by following some online tutorials, and putting my own spin on them. I found a pretty good tutorial at pythonspot.com, but I am not sure what some of the ...
1
vote
1answer
78 views

glViewport() Win10 doesn't draw new parts

I've been steadily working through building a basic 2D tile framework in python. I'm trying to use modern openGL so I have a simple shader and some vertex buffers and it's mostly doing what I want so ...
0
votes
1answer
64 views

Please help me find the error in a pygame code for Tetris?

I am creating a Tetris game using Pygame. However, instead of calling a single shape, but code calls all the functions for the shapes randomly one after the other. I tried called the NewShape at ...
0
votes
0answers
85 views

How would I use Await/Async to create a pygame network game

What I have Tried Hello, I have tried to create a asynchronous network for a special game project I am making. I have tried using plain old sockets but what I discovered is that they would block each ...
1
vote
1answer
129 views

How do I sort with both depth and y-axis in OpenGL?

Continuing my misadventures in pyOpenGL, I've refactored the whole thing to use 4 buffers: tile vertices - all drawn at the start, probably never modified tile texture co-ords - not modified often (...
2
votes
1answer
172 views

How should I implement a dialogue box in Pygame?

I'm working on a small RPG with Pygame, using Python 3.5.1. I've spent a week trying to find a decent tutorial or example for a dialogue box implementation that would pull dialogue from a source file (...
5
votes
1answer
117 views

pyOpenGL draw loop - slow with just 1500 items to draw

I've been trying to build myself a simple little game API using pyOpenGL (previously I tried using just Tkinter, but I keep hitting the same wall whatever I do!) I rewrote everything using my very ...
1
vote
0answers
43 views

Collision for array of pathfinding zombies to array of blocks

Relevant Background Information I'm an eleventh grade high school computer science student in Canada. I'm doing pretty well in the course currently, I have a 96 in the course currently. We're working ...
1
vote
1answer
113 views

Performance drawing in Pygame

Relevant background information I'm developing a game for a high school computer science performance task in python & pygame. I'm using objects and all the code is working well for me. The game ...
1
vote
2answers
142 views

Using sprites in pygame without classes and objects

Relevant information I'm in a grade 11 computer science class that uses Python & Pygame. We're aloud to use sprites and images though we're never taught it, just drawing graphics like squares and ...
0
votes
1answer
130 views

How to rotate a surface in pygame, without changing its shape

I'm writing a class in pygame to create a sprite object, and I'd like to be able to rotate it. It works fine with an image, and rotates without issue. But when rotating a surface with a plain colour, ...
0
votes
0answers
33 views

Can I map uniform variables?

I'm literally just starting with GLSL, I'm using python and I actually can't run 330 (intel hd3000 on Debian) so I'm using 130, so far is ok. I started using in first and didn't know about uniform ...
0
votes
1answer
60 views

pygame scrolling: target moves faster than the camera

I know many questions have already been asked on this same topic, but I can't figure out from those how to solve my problem (possibly due to a different approach to achieve the same goal: scrolling my ...
0
votes
1answer
53 views

Bounding box collision handling makes player glitch to the other side of the wall

The way I handle simple collision detection causes a really frequent and easy to reproduce glitch, which affects gameplay severely. Here's my code (Python 3.5): def move(self, _map): self.col = ...
4
votes
1answer
143 views

Programming with Python in a recent version of Minecraft

I've been teaching Python programming to a friend's son using the book Adventures in Minecraft. This book comes with a starter kit that contains a pre-configured Bukkit (v.1.6.4) server, and targets ...