We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [python]

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

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

Rolling a circle around a square

I am stuck on a simple Box2D task. I have a box and a ball (in top-down view so no gravity), and I would like the ball to roll around the box. Here is my code. Basically now I am trying to detect ...
0
votes
2answers
43 views

Find angle to a point

I'm trying to find the angle between a point and the left side of my camera's fov. In the picture below the camera (Red dot) is looking towards a polygon (Green) with the fov of the camera ...
0
votes
1answer
11 views

Pybox2d Collision detection explanation

Hi I am working on a PyBox2D game and it became quite complex and I need to learn about collisions, so I made this very simple script in order to learn collision setting more effectively, however I am ...
1
vote
2answers
110 views

How can I make my race game fair with all players and keep it climatic?

I'm making a minigame where up to 5 players have to race against AI or another player(the "enemy"). The race consists of prompts, the current player is asked to press a key in a given amount of time ...
0
votes
0answers
27 views

Fast route for utilizing images produced in python matplotlib (or within Julia) to be displayed in Unity?

I would like to use within Unity heatmaps produced with matplotlib invoked using python or julialang such as the heatmap shown in: Source: heatmap from matplot lib I can invoke python (or Julialang) ...
0
votes
0answers
23 views

Isometric tile selection formula is slightly off

I almost made the isometric tile selection formula work but it seems to be slightly off. It seems to be working correctly when the mouse is hovered over the first half of the tile but it jumps to ...
0
votes
0answers
50 views

Editing this code to put in my own sprites and textures?

I have to make a game for class and have to have scrolling camera, fully textured background, and have the sprite be fluid. I need the rectangle to be turned into a sprite. This code I found on https:/...
1
vote
0answers
23 views

PyOpenGL Cubemap ARB Texture not rotating with gluSphere

I've made a gluSphere render in my display and have given it a cube map texture of the Earth. The texture is visible just fine (see below), but I cannot get it to rotate along with the shape. this ...
0
votes
1answer
33 views

How do I permanently set the interpolation for every image, sprite, and texture in pyglet to GL_NEAREST in pyglet?

There are plenty of examples of posts that describe how to set the default interpolation of specific images to GL_NEAREST, for example here, but they all have to be run after the image texture is ...
0
votes
0answers
65 views

How to support JS/Python scripting a C++ game engine

I'm currently writing an Entity/Component/System architecture game engine in C++, and I have the beginnings of a lua scripting system in place, which seems to be quite popular, but I feel Javascript ...
0
votes
1answer
47 views

how to move object in a circle around point?

There are two controllable objects orbiting around a centre block. Unfortunately, I don't really know how to stick them so they can only move around the block (left/a sends them clockwise, right/a ...
0
votes
1answer
27 views

Calculate normal angle in screen space

I'm working on adding billboarded sprites to a game engine, but the engine allows for walking on curved terrain, like spheres. In order to look like the player is walking on the terrain, I want to ...
1
vote
1answer
52 views

Model gets distorted when rotating the camera

I'm currently developing my own 3d graphics engine and I'm having a hard time figuring out why my 3D models gets distorted when rotating the camera around. This is my projection matrix. I'm following ...
0
votes
0answers
25 views

Python - frame buffer and Tkinter

I'm trying to make a simple game in Python that uses Tkinter for the window (Tkinter comes with Python which is why I chose it) and I need to be able to store a frame and then create a new one instead ...
0
votes
0answers
27 views

How could I calculate the distance between the parent and neighbors node when there is a line of sight between two points?

I have completed my Astar algorithm in Python and now I need to convert it to a Theta star algorithm, I have built my line of sight algorithm below, but when I come to my Theta star algorithm I face ...
0
votes
0answers
96 views

Theta Star algorithm with line of sight

I have finished my A star algorithm and I need to add the work of Theta star to it, but I need to call the line of sight algorithm. I'm working on path planning for a UAV and I have created a grid in ...
0
votes
1answer
55 views

Collision detection and solution causes teleportation on corners

I am making my own game engine on Python and I got stuck with collision between objects. ...
0
votes
0answers
26 views

Snake Python 2nd player wont move

I'm trying to code a two player snake game, a the moment the first snake works perfectly but, my second snake won't budge. I used the same layout code for the 1st and 2nd snake but only the first ...
0
votes
0answers
32 views

Pygame Mask Doesen't Detect Collisions

I'm trying to make my game's collisions with masks. I have 6 masks but only 2 works. My code is: ...
0
votes
1answer
34 views

Pygame Updating Display Without Being Told To

The following (abridged) bit of code is inside the main loop. What I expected to happen was the entity's position to update due to velocity, then update again if it's touching a static object before ...
0
votes
0answers
129 views

OpenGL.error = 1282 How to fix it?

I'm running a python script in Nvidia xavier board using a pyqtgraph.opengl and I installed python3-pyqt5 (5.10.1 installed, and qt 5.9.5) When I run this script below ...
-2
votes
1answer
77 views

How should I go about creating a multiplayer pac-man game in python? [closed]

For some context, I am making a Pac-Man game (using pygame) and I need a little guidance on how to structure the multiplayer side (using sockets). I have a few ideas (the first of which I have tried) ...
0
votes
0answers
16 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
13 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
58 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
30 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
78 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
35 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
106 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
1answer
67 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
198 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
43 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
39 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
42 views

Rotating a sprite with Pyglet without changing its X and Y

I have code which rotates a sprite: ...
0
votes
1answer
60 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 ...
12
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
261 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
57 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
79 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
92 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
197 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
26 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 ...
1
vote
1answer
120 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
430 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
57 views
-1
votes
1answer
386 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
76 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
208 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
160 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
171 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 ...