Questions tagged [python]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
10 views

How to reset Camera and Hero position at new level in pygame

I'm working on a 3rd level of my game. When the 3rd level begins the Camera and Hero position is getting same value which was left by the 2nd level at the end point. I'm not able to find a way around ...
0
votes
0answers
7 views

MacOS looking for 'vsh.cli' in the wrong directory after installing vsh

I am following this tutorial for introductory Python roguelike development using the library libtcod. when I run vsh rl in the terminal as instructed, I get the ...
0
votes
0answers
20 views

How to scroll background image from start in pygame

I'm making a game which has 3 levels. I have successfully created 2 levels and everything runs fine, but when I try to reach level 3, it loads the background image from the middle and it get stuck ...
0
votes
0answers
12 views

How to draw edge shape in Pygame using pyBox2D

I am trying to define boundaries for my pyBox2D car, some kind of race track, I am using this code to define the boundaries: ...
0
votes
0answers
16 views

How to create polygonal or elliptical colliders by python tkinter?

I am developing a primitive game by python tkinter (I use canvas). It's not a big project. It's only my own self-challenge to create a game using only tkinter and standard python libraries. My problem ...
0
votes
1answer
34 views

How to make player move into next level in pygame

When my player reaches at the end of the map, I want it to enter to next level. I've created first level and it all works fine. All I want to do is that when player finishes 1st level I want to load ...
0
votes
0answers
27 views

How to implement a simple chat option for server-client based game (blender/BGE)

I want 2 players to be able to chat with eachother. I have a running server-client game, but I'm kind of stuck on this one. Since there are only outdated videos this is an example I need: https://...
0
votes
1answer
93 views

PyBox2D car moves uncontrollably

I am trying to program TopDown Car using python and Box2D (similar to this tutorial: http://www.iforce2d.net/b2dtut/top-down-car ) The steering is so far limited to thres states of wheel rotation, ...
-1
votes
0answers
27 views

PyGame Freezes Changing the “y” Rect

I'm trying to the Sprite DualBone to the left using a while statement. My script is ...
-1
votes
1answer
50 views

How to make player land on platforms more than one in pygame

I'm trying to make multiple platforms (blocks) on screen on which player can jump and land on it. When I just keep only one block, player jumps on it and land easily. But when I create other platform ...
1
vote
1answer
126 views

What is a good algorithm for a stock market simulation?

I am making a text game about investing in the stock market, however I need a better algorithm, as the current simulation just goes up and down randomly. How can I make it so that its a more realistic ...
1
vote
1answer
36 views

*Python* Class - self.x = self - What does it mean to set it to self?

I have this class for my game that is a scene manager. I followed a tutorial and I am confused on why the self.scene.manager is equal to self ...
1
vote
0answers
34 views

How do I organize this code to be able to have a menu system that can be nested?

I am a beginner programmer and I have been experimenting with pygame (uses python if that is not obvious) through tutorials and such. I am stuck because I have not been able to figure out how to make ...
0
votes
0answers
27 views

Rotating a sprite with Pyglet without changing its X and Y

I have code which rotates a sprite: ...
0
votes
1answer
31 views

How do I add collision between two player controlled turtles

How do I add collision between two player controlled turtles. I asked the question before but misunderstood my own groundings on the plan. I cannot figure out how to make two player controlled turtles ...
13
votes
6answers
3k views

Efficient Algorithm for the boundary of a set of tiles

I have a grid of tiles of a known finite size that forms a map. Some of the tiles inside the map are put into a set known as a territory. This territory is connected, but nothing is known about its ...
0
votes
1answer
72 views

How do I apply collision to a turtle

I cannot figure out how to apply collision to a turtle. I am in need of help for collision with pen lines and turtles. I want the two to hit and restart the game but I can't get collision on either. <...
0
votes
2answers
41 views

How can I set decimal values to a Pygame rect position?

I'm trying to make the gravity a bit slower, like ...
1
vote
2answers
61 views

Pygame - Maze collisions problem

I am a beginner in Python and Pygame and I have a problem with my game in pygame. I have Maze class and Player class but I can't do proper collisions. I reached the moment where I have no idea why my ...
0
votes
2answers
85 views

Pygame Collision Bug

I'm trying to add collisions to my first game, and it has a bug. My code is: ...
0
votes
0answers
147 views

Why are pyglet.image and texture so heavy?

Envrionment: python: 3.6.6 pyglet: 1.3.2 Here is my code and results: ...
0
votes
0answers
25 views

creating levelup stats based on curves [duplicate]

I'm creating a simple level-up system and I'm looking to base the stats gain on curves so I can tweak them easier, I know it's a math function, but I have no idea what to search for. I need to create ...
0
votes
1answer
91 views

How can I rotate my character so that he is facing the mouse?

I just want to preface this by saying I am very new to pygame. At the moment I have calculated the angle that I need to apply to my character so he can rotate but I am unsure how to actually make ...
0
votes
1answer
166 views

Pygame Error AttributeError: 'pygame.Surface' object has no attribute 'add_internal'

I'm making my first game of Pygame. I'm going to create groups for making collisions but when I add an object to the group, I get an error in sprite.py (Pygame's Files) ...
0
votes
1answer
45 views
-1
votes
1answer
181 views

Pygame for Android

Do somebody know how to make pygame games for android? many have done this but i still don't know how to do it. I googled it but there is no clean step by step tutorial. Can somebody answer this ...
0
votes
0answers
64 views

Render Pygame sprites with PyOpenGL

I am using Pygame for rendering my sprites, however that work is done on the CPU side. For performance reasons I would like to change to drawing those sprites using PyOpenGL. How can I take textures ...
0
votes
1answer
96 views

How to convert coordinates between world coordinates and screen coordinates

I am using a tilemap in which I have square tiles. Knowing that, the size of the screen and the player position(in world coordinates) how I convert between this systems? Is there any formula? EDIT: ...
0
votes
1answer
112 views

PyGame - Top down shooter mechanics

I'm currently developing a game for some school work using the PyGame library for Python. I'm almost done with most of the game's core mechanics, but have gotten hung up on the shooting mechanics. My ...
0
votes
0answers
96 views

Snake game with Sprites python

I've been trying to make a game of Snake (I'm a beginner/intermediate, so this is a way for me to try to get the basics of new things I learn), and I've been trying to do it with sprites. I would ...
0
votes
1answer
47 views

Finding Closest of 8 Possible Angles to Theta Value

I'm working on creating a gesture recognition system, and I saw one simple implementation that isn't as accurate, but is really easy to implement. The idea is that you have a unit circle with the 8 ...
0
votes
1answer
46 views

Collisions in other sides on pong in python

Im trying to create pong in python, so far Ive set up correct collisions on the right paddle but upon just trying to reverse the code to work with the other side it refuses to work, simply glitching ...
0
votes
1answer
175 views

Why doesn't my pygame window close on MacOS?

I am trying to create a window and then close the window. Everything runs smoothly until I click the red X. When I click it, the window doesn't close and all that happens is that the colourful red ...
0
votes
0answers
27 views

Wii accelerometer data ranges

I have 2 related questions, please. I am using a wiimote on a robotics project and I need to convert X and Y values into new bounded values. So, give the following accelerometer data: ...
2
votes
2answers
205 views

Generating different maps using Perlin Noise with a seed

I am developing a 2D game in python and I could get Perlin Noise working with this code: ...
2
votes
1answer
161 views

Perlin Noise generation always returning zero

I am using noise and I can't get Perlin Noise working, only the Simplex Noise. So far I got this: ...
0
votes
1answer
32 views

Python: I have a python statement which should work but it doesn't [closed]

The error in the picture is highlighted in red. So, I have used this code on another computer and it worked, why wont it work now? I may have made a really small and stupid error and if I have I'm ...
0
votes
1answer
32 views

Determining which way a wall faces in a 2D grid with minimal boilerplate

I have a 2D grid of quadrilateral tiles, some of which are walls, some are floor; each tile has four vertices, which are shared with the tiles around it (so each rendered "wall" is at least two wall-...
0
votes
1answer
58 views

Getting event types in Pygame

I want to have the type of an event from the event queue to decide certain actions (i.e. if it is a joystick event or a keyboard one), but the dir of events is an ...
1
vote
0answers
147 views

Python:Adding enemies and weapons in game (Text-based adventure game)

I'm a beginner in coding and game-design also and try to make text-based adventure game, where player should move between rooms, fight with zombies and pick up weapons. Any help, namely tips and ...
1
vote
1answer
569 views

How to resize a surface in Pygame?

How can I resize a Surface object in Pygame? Is there a way to bind a surface object into a Rect object, so that resizing the ...
1
vote
1answer
121 views

How to get camera to follow car

i am making a top down racing game where the car progresses along the track, however i need the camera follow the car as it progresses through the track. I am unsure how to fix the error. I am new to ...
0
votes
2answers
227 views

Pygame platformer - Making sprite jump

I am currently trying to make a Mario-type platformer using pygame and the MVC design pattern. My progress as of right now is getting a character on screen and having it move left and right. My goal ...
2
votes
0answers
54 views

Non-Perfect maze generation with objectives [duplicate]

I need an algorithm that can generate mazes with these requirements: Allows for random structures to be made (Ex: a center spawn area, objective points and 'Caverns (corridors with 2 or more ...
0
votes
1answer
57 views

processing request in order on game server

I am creating a simple multiplayer puzzle game in which multiple players can join a lobby and compete with each other. the player that submits the answer first gets the highest point, the player that ...
0
votes
1answer
207 views

Using PyOpenGL, can I rotate raw data rather than the current matrix?

I'm trying to create a sort of PyOpenGL renderer for the Bullet physics engine, and at the moment I'm rotating my basic cubes with math in Python. However, if I do the math in Python that's going to ...
0
votes
1answer
49 views

First “If” Enemy Selection Function being recognized as a syntax error in Python

I have an issue with trying to under the syntax error with the line if enemy_select = 1: in this type of code: ...
3
votes
1answer
673 views

Adding character stats/traits in Ren'py

I'm coding a relatively simple VN with RPG elements in Ren'py, with little prior programming knowledge. There's one aspect that I can't simplify further because it's important to the game's branches, ...
2
votes
1answer
137 views

Pathfinding, 2+ tiles wide

I recently started learning python and I'm working on a dungeon generator, using images for the rooms, hallways and junctions. Example of desired result. So far I managed to generate a X * Y map and ...
0
votes
2answers
206 views

“RuntimeError: Validation failure (0)” using shaders

I'm trying to move away from using glVertex() in my game code because it doesn't seem to work well with a large quantity of vertices. At the moment I'm trying to make code that uses Shaders, but when ...