A game development library based on the Python programming language. It wraps SDL for easy use alongside Python.

learn more… | top users | synonyms

0
votes
0answers
7 views

Pygame Vertical movement of a comet

I try to make a platform game where comets will collide as the character,this comet must fall from a vertical angle This is my code: # coding=utf-8 import sys import pygame import random pygame....
2
votes
1answer
30 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 ...
2
votes
1answer
66 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
33 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!
1
vote
1answer
435 views

Collision in PyGame for spinning rectangular object.touching circles

I'm creating a variation of Pong. One of the differences is that I use a rectangular structure as the object which is being bounced around, and I use circles as paddles. So far, all the collision ...
1
vote
2answers
64 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 dont know how to add collision detection, so when the ball hits the ...
1
vote
2answers
84 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 ...
2
votes
1answer
260 views

pygame for python 3.5

I am running python 3.5 and I want to install pygame, the website only supports up to version 3.2. I have tried a few forums on this and other websites but they are all for python 3.4. Does anyone ...
2
votes
2answers
1k 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 ...
1
vote
1answer
85 views

How to use collision masks and overlap_area in pygame?

So, I've been prototyping a game, and I've been using sprite collision, and it's not cutting it any more. I read up on the documentation about masks and overlap area: https://www.pygame.org/docs/ref/...
0
votes
1answer
147 views

Pygame wall collision is acting very odd

I've been playing around with python for a while, but I only did basic functional programming. Lately, I've been teaching myself about classes. I've been using pygame (instead of tk, because let's ...
1
vote
1answer
47 views

How do I update individual sprites within a spritegroup in pygame?

I have a for loop that takes values from a text file, and then creates and adds a bunch of sprites to a group platformlist_list. The for loop will continue until every line of the text file is read. ...
2
votes
1answer
50 views

Pygame time.get_fps() value

I was looking at the pygame.time.Clock.get_fps() method and after puting it inside of the while loop printing and checking it some times, i see that i starts to give its value after five frames (and ...
0
votes
1answer
104 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.). ...
0
votes
2answers
84 views

Fast Flood Fill in Pygame?

I am creating a simple game in Pygame for my kids. It involves intersecting random complex curves. Some of the intersections can be coloured in different colours. I have implemented a flood fill ...
0
votes
0answers
32 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 ...
1
vote
0answers
59 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 ...
4
votes
2answers
99 views

Line Collision In Pygame?

I am working on a game(a platformer) that is physics and momentum based. I want to make it so that the player(a single dot) can bounce off of the lines with correct physics, but to do that, I need to ...
3
votes
5answers
305 views

What can be a game-play element in a game with Shakespeare's plays as the main theme? [closed]

I was thinking of learning about making games, so I thought of an idea about making a game on a play, since the content is already there. I actually found well parsed XMLs of Shakespeare's plays. I ...
0
votes
2answers
91 views

Rotating hitboxes in pygame?

I'm using pygame.rect.colliderect() to check hitbox collision between sprites in my game, but now that i'm rotating the sprites, I'm realizing I can't do this because there's no way to rotate a pygame ...
0
votes
1answer
47 views

How can I take a screenshot of a certain part of the screen in PyGame?

I need to for my pixel art tool that I'm making to help myself make games.
0
votes
1answer
57 views

How to figure out which tiles are within view, and where to draw them in the grid

I know there are a few questions on here similar to mine, but none of them seem to fit my needs. I'm using pygame to implement a tile based game similar to final fantasy or zelda from the early ...
0
votes
0answers
39 views

Pygame image blitting makes game lag

So I have a tile-based game that is 216X384 units large. Each square in the cell_array is grass, which I pre-loaded with convert_alpha(). Each time it draws (I have fps at 30), it cycles through the ...
0
votes
0answers
22 views

Pygame Colorkey works on the image surface but not on the screen

I running pygame on python 3.2.3 and trying to make a pygame 3 Agar clone. I've created simple sprite objects using draw.circle and drawn them to their own surface called image. I've then used ...
-1
votes
1answer
44 views

How do I get a vector from an angle?

I want a ship to move forward in the direction it's facing when you press the up key, but I don't know how to get a normalized vector from the angle the ship is facing. Can someone show me what code ...
7
votes
4answers
11k views

Which language and tools should I choose for creating 2D games? [closed]

Recently I have returned to my childhood hobby (programming games) and found it quite enjoyable. I've been tinkering with PyGame (for Python) for a few months, made a couple of projects for ...
2
votes
3answers
372 views

shuffle a sprite group

Is there a way to shufle a group of sprites created with: pygame.sprite.Group() I have tried using random.shuffle but it apparently doesn't work on sprite groups.
2
votes
4answers
1k views

sprite group doesn't support indexing

I have a sprite group created with pygame.sprite.Group() (and add sprites to it with the add method) How would I retrieve the nth sprite in this group? Code like this does not work: mygroup = ...
2
votes
1answer
134 views

Collision detection with PyGame

I have been making a 2d platformer using Python with PyGame. It has all be going good, but I have stumbled accross many problems with collision detection. Here they are: You can't go through objects ...
0
votes
3answers
582 views

Python mini RPG enemy movement. (how to have two infinite loops running at the same time)

I have a problem with my RPG. I want enemies to wander randomly. So I put: enx_speed = random.randint(-2, 2) eny_speed = random.randint(-2, 2) in the main loop (while true:). However, that loops ...
0
votes
1answer
36 views

Pygame.display.set_icon unable to show transparecy

On Python 3.2.5 32 bit, I installed pygame. I made some code with it. It included pygame.display.set_icon(image). The image file is .png and I loaded it by using image = pygame.image.load("clockico....
2
votes
1answer
147 views

What Is A Good Way To Make A Self Updating Game? (Python) [closed]

I've been making games and I have always had a problem if I wanted to sell a game. People would have to re-buy games to get the updated version. Does anyone have any ideas on how to make a self ...
0
votes
2answers
24 views

(Pygame) Sprite disappearing on collision

I am making a game, and when the player runs into a certain block it changes the size of a circle on the top. The problem is, whenever the player runs into the block it disappears. How can I fix this?
5
votes
1answer
786 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
0answers
42 views

how to increase lenght and make body of snake in pygame

I'm programming a snake game and I'm not sure how increase the length of the snake. Main part of code: lead_x=300 lead_y=300 dirx=right(default) if dirx=='right': lead_x +=...
2
votes
3answers
219 views

Scaling surface changes colors

I'm building a pixel art game with pygame, and I'd like to scale it to double the size. I have tried the pygame.transform methods like scale and scale2x, but they seem to alter the colors quite badly, ...
0
votes
0answers
18 views

Spritesheet trouble / code review

http://stackoverflow.com/questions/34563084/spritesheet-trouble-code-review If the player presses right, i have an image of a guy facing right. Left, up, and down same concept. if he holds the button,...
0
votes
1answer
44 views

Remove bullets from sprite Group

I'm having an issue with removing objects from a sprite Group. What is happening is I have a bullet class and every time the user presses the player shoots a bullet. I have 'alive = bool' code and ...
0
votes
0answers
40 views

How can I make bullets go to the cursor in Pygame properly

So hey, I'm new into making games and programming at all, I tried to make a small game thingy in Pygame that would include a dude shooting bullets and stuff. However, I can't really get the shooting ...
0
votes
1answer
41 views

Pygame making Snake, need help with generating fruit with a random color

This is my function for generating an apple, I want it to generate a random color each time the snake eats it. def AppleGenerator(): fruit_colors = [crimson,powderblue,yellow,hotpink,...
1
vote
1answer
28 views

Text blits to screen at wrong y-coordinate

I have a program that is meant to scroll numbers/letters down the screen, like in the movie "The Matrix". When one of the columns reaches a letter in the user's name (obtained using user input), it ...
2
votes
1answer
134 views

Pygame freezing on QUIT

I'm having problems with quitting a Pygame application (6502 based computer emulator). The part regarding exit looks like this: while True: do_something_200_times() for event in pygame.event....
2
votes
0answers
44 views

Does the latest version of Python have libraries for easy host/server connections? [closed]

We're working on a turn-based multiplayer Risk-type strategy game in Pygame, and I was wondering if there were any pre-existing libraries like PodSixNet that worked for Python versions 3 and up that ...
0
votes
2answers
71 views

Pygame Scrolling Camera bug

I asked a question the other day about how to implement a scrolling camera. I got a great answer which helped me achieve that... but in doing so I have lost basically all collision detection. ...
0
votes
1answer
423 views

In Pygame, how can I check if an object is touching a color?

Is there a way to tell if a sprite is touching a specific color on the screen, maybe given as a hex code. I know you can do pygame.sprite.collide for sprites, but how can you do this for a specific ...
0
votes
1answer
3k views

Locking the frame rate in pygame?

I am having trouble setting up the frame rate in my first game. I know that I can set it up with clock = pygame.time.Clock() clock.tick(60) but this is not producing very desirable results. If I ...
0
votes
1answer
120 views

How do I get pygame to work on intel processor?

I downloaded Python 3.4 64 bit IDE and pygame but whenever I tried installing pygame it would say "Not supported on Intel". So are there version of pygame available for Intel processor or are there ...
3
votes
2answers
1k views

PyGame custom isometric engine : caching or not?

In the game I'm making, I need an isometric view with some altitude, which means players can go behind a hill, and be partly or totally hidden. To avoid re-drawing the whole view tile after tile every ...
0
votes
1answer
131 views

How do I check if pressed on a text in pygame?

How do I check if pressed on a text? This is how I draw the text: # Full code on https://github.com/Zwengel/bunny-badgers height = pygame.display.Info().current_h font = pygame.font.Font("...
2
votes
1answer
154 views

Move an enemy towards the player in pygame

I set variables for the distance between the enemy and the player along the x-axis and y-axis. My plan is to move the enemy along the hypotenuse formed by y and x-axis line at a constant speed. The ...