A game development library based on the Python programming language. It wraps SDL for easy use alongside Python.
0
votes
1answer
54 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
68 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
1answer
21 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
118 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
34 views
Collision Detection in Pygame
I'm making a game where the main character is a cat and has to avoid dogs and eat food. The collision detection works for the dogs and will subtract a bar of health from the cat, but when the cat ...
1
vote
1answer
61 views
Issues with player movement and character interaction within Pygame
I am working on a small game that deals the main character, which is a cat, and dogs that chase it. The dogs are able to wander around like they are supposed to do, but the cat will only move a small ...
1
vote
1answer
58 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
33 views
Possible Framerate Problem using Pygame?
This is the first game I've ever tried to make using Pygame and I am running into some issues displaying the player character and the enemy characters. I have a "main" game file and other files that ...
0
votes
0answers
46 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
1answer
29 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
100 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? ...
0
votes
1answer
71 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....
-3
votes
1answer
79 views
How do I set the truck to run on the road, recognizing the black edge as the road?
I am rewriting the Bad Roads game with pygame, for AI research, having extracted the assets from the APK file. I have the truck images and the background:
How do I set the truck to run on the road, ...
1
vote
1answer
270 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 ...
1
vote
1answer
168 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 ...
1
vote
0answers
81 views
Reimplemented steering seek behavior from PyGame to LÖVE is much slower than original
I'm learning about steering behaviors and watched this nice explanation tutorial - https://www.youtube.com/watch?v=g1jo_qsO5c4&feature=youtu.be with the source code available at https://github.com/...
-1
votes
1answer
57 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
74 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 ...
2
votes
1answer
154 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 (...
1
vote
0answers
41 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
109 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
140 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
118 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
1answer
53 views
pygame on windows doesn't load sounds
I had written a program using PyGame that should play sounds. I created sounds in Audacity, saved it as WAV (Microsost) signed 16 bit PCM. They are played well on Linux, but aren't loaded in Windows. ...
0
votes
1answer
56 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
47 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 = ...
0
votes
2answers
115 views
How can I make the player “look” to the mouse direction? (Pygame / 2D)
Here's my code:
import sys
import pygame
pygame.init()
screen_width = 640
screen_height = 480
screen = pygame.display.set_mode((screen_width, screen_height))
running = True
class Actor:
def ...
0
votes
1answer
57 views
Spell and Terrain Interaction in Game
I am currently thinking about working on a small game where the player has to get rid of mob waves in an arena. The game is going to be 2D top-down.
What I want from this game is the player to be ...
0
votes
1answer
239 views
How to display text for 3 seconds in pygame
I am trying to print "You Crashed" when car hits wall(or blocks) for 3 seconds and then again start game loop.
I tried using time.sleep(3) but it's not working.
def crash():
crash_font = ...
1
vote
2answers
124 views
How to implement the missile trajectories in the classic missile command game - pygame
I am doing a clone of the classic arcade game missile command, i am curious about how to implement the trajectories of the missiles. I have a solution that looks pretty similar to the original game, ...
1
vote
1answer
41 views
What is Surface.set_colorkey() in Pygame
In pygame, what does Surface.set_colorkey() do? Explain it in a very easy way please. Also, what exactly does it do? I heard it makes parts that are the same color as the colorkey transparent, but ...
2
votes
2answers
75 views
Can't move rectangle constantly with key down
I can only move the rectangle every time I push a key down. How would I continuously move my shape when the key is down?
Here's my code:
for event in pygame.event.get():
if event.type == ...
1
vote
0answers
33 views
If I create a pygame, can I later convert it to a .exe for everyone to use? [duplicate]
I was told if I create a pygame, other people would need python/pygame to actually run it. Is that true? Or is there a way I can later convert it to a .exe?
0
votes
2answers
78 views
How to make an object move outside the map and appear on the other side with a tilemap?
I have a tilemap where a character moves from tile to tile. I'm trying to make it possible for the character to move outside the screen and reappear on the other side, just like the tunnel in Pacman.
...
0
votes
1answer
69 views
Python collision left works, but not right
I am continuing to work on collision detection. It appears for the most part, everything I have implemented is working. When the game starts, the character is on the left side of the screen (plus a ...
0
votes
1answer
44 views
Python collision problem
I have a hero character with jumping physics that I am trying to figure out the collision detection for. Right now, the problem that I am running into is as soon as the character hits the floor (while ...
2
votes
0answers
35 views
SGC toolkit for PyGame and resizeable windows
Can I create a resizeable main window if I use the SGC GUI toolkit for PyGame? If so, how?
0
votes
2answers
84 views
How should I make a jump-timing game's character static on screen?
I decided to learn Pygame and try to make a simple game inspired by Google's T-rex jump game. However, I stumbled upon a problem that I can not seem to figure out: How can I implement a scroller/...
-1
votes
2answers
156 views
2d MMO world generation? [closed]
I am developing a MMO, and i'll describe it as a 2d mine craft (it's a lot more complicated than that). There will be a multitude of blocks that will be in a world. I need them to be randomly placed. ...
0
votes
1answer
107 views
Lag in collision detection
I am a beginner with PyGame and am currently making a simple game using but I am having difficulty with the collision detection. When the game runs, the response to the collision detection (printing ...
1
vote
2answers
121 views
How to initialize OpenGL context with PyGame instead of GLUT
I'm trying to start with OpenGL, using Python and PyGame.
I'm going to use PyGame instead of GLUT to do all the initializing, windows opening, input handling, etc.
However, my shaders are failing to ...
0
votes
2answers
321 views
How to rotate an image in pygame without losing quality or increasing size or moving position
I am trying to make a game in which I place a spaceship (its an image I downloaded) in the center and then rotate it on its place. However, when I use pygame.transform.rotate(), it rotates the image ...
3
votes
1answer
440 views
How to make a moving background with PyGame?
I'd like to create a moving background in my Python game, with an image, that moves up until it reaches the end, then it goes back to its first position. I'm still in my learning process and this is ...
4
votes
2answers
326 views
Implementing Story and Quests in RPG
This question in very similar to this question, however I am still confused about how one would implement a story and quests in a finite state automaton RPG.
This is my first game that I am making (...
-1
votes
1answer
328 views
How to make a Infinite Verticle Scrolling Background in Pygame
Is there anyone who knows how to create an infinite verticle scrolling background in pygame?
Your help would be much appreciated, thanks in advance!
2
votes
2answers
173 views
Pygame: Collision detection
I've been adding some extra stuff like Gravity and a table to a simple pong game made with Pygame and Python, the problem is that I don't know how to add collision detection, so when the ball hits the ...
0
votes
1answer
116 views
How to program destructibles?
I'm thinking about programming a 2d simulation of a spaceship that takes damage depending on where the projectile came from (e.g. from behind - engine, from the front - lasers, sides - hull, etc.). ...
1
vote
1answer
492 views
How to integrate Tiled maps and collision detection with pygame?
I have been using pygame to make a simple rpg pokemon style game. To create maps I have used the Tiled map editor and then loading them into pygame using pytmx.
I have heard that you can add object ...
0
votes
0answers
34 views
How To Point An Object At Cursor? [duplicate]
I'm trying to make a Nuclear Throne like game in python 3 and pygame, but I got stuck at how to make the gun point at the cursor. If someone could show me how, that would be great. :D
I looked at the ...
0
votes
4answers
168 views
PYGAME: When I release two directional keys together the player keep moving
I did the code this way to avoid the player to stop if a press two directional keys together making the movement more smooth. It works well but when I release two keys or more together the player keep ...