Questions tagged [python]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
12 views

Why is my program “not responding” when I run it?

I'm trying to learn to code with python and while using pygame, I came across this: every time I run the window it says "not responding". Specifically, it happens when I click to drag the window; the ...
1
vote
0answers
39 views

Avoiding Global Variables in Event Driven Programming

First off is "procedural event driven programming" a thing? My question is about global variables in the context of an event driven program that doesn't use OOP... I have written a simple Snake game ...
0
votes
0answers
32 views

How can I remove a sprite from the screen using pygame?

I am having trouble with removing sprites on my screen using pygame. I am killing my sprite with sword.kill which is removing it from an all_sprites group, so it should disappear right? Here is ...
0
votes
0answers
28 views

How do a make a smooth animation with images of different sizes in pygame?

I have an animation where my player swings his sword, with 5 images in pygame. The normal resting image is 14x22, and the rest are 13x23, 21x23, 18x23, and 18x23. I am having trouble with my character ...
1
vote
1answer
40 views

Box collisions between vehicles in traffic pattern

I'm working on a traffic simulator. Right now, I have ways to manage 4-way stop intersections and a solution for efficiently determining which vehicles are colliding with one another. All vehicles ...
0
votes
0answers
20 views

pygame multiple collisions between two objects

Ok, so I have been trying to figure out how to set this up and can't get it working properly. I'm trying to get the functionality similar to the moving logs in the game Frogger if you are familiar ...
1
vote
2answers
49 views

Attempting to have a group of units create random values independently in python 3 for a salvage loot system

I am working on creating a salvage mechanic for my game. I want different units to calculate salvage after an encounter to randomly determine how much each one was able to scavenge from fallen allies ...
1
vote
0answers
39 views

How to convert screen to world coordinates while using gluLookAt / gluPerspective or similar matrix transforms?

I am just starting an adventure in looking under the hood of graphics for a game project I've been working on for a while, and I could use some guidance. I am using Python/Kivy (though that is not ...
0
votes
0answers
24 views

Interactive map designer

I've made a simple game in pygame/pymunk. Currently my maps consists of lists with functions, e.g ground_segments = [ground(position, size, shape...), ...] I ...
0
votes
0answers
43 views

Procedural generation for a text adventure game [duplicate]

I'm working on a text adventure game written in Python and I am at the point where I need to implement procedural generation for the map. As the user moves around, spots are generated, so the entire ...
4
votes
3answers
208 views

How can I add biomes to my generated world?

I need a way to generate a world realistically. I want to generate worlds similar to dwarf fortress. My current code for world generation is this: ...
0
votes
0answers
29 views

Collisons with rock and player(spaceship)

I'm trying to make when the rock hits the spaceship or player it should decrease the health from the health bar but when I run it, it doesn't work. The rock decreases the health randomly. How can I ...
0
votes
0answers
57 views

Procedural dungeon generation

Im making a rouge like game, and I need a better way of generating a dungeon. My requirements for a dungeon must be: Have multiple rooms and corridors All rooms and corridors must be accessible My ...
0
votes
1answer
51 views

MMO Chat system methods

I'm working on a little MMO game as a learning experience, the server coded in Python. When a player logs in it pulls their character data from a SQL db and into server memory. It then uses memory ...
0
votes
1answer
73 views

Collision detection / physics for simple game

I am currently working on a mini game for class (first time doing something like this) and I don't really know how to start with collision detection at all. The game I'm creating is a top down sumo ...
1
vote
1answer
50 views

Unexpected behavior of bodies affected by gravity in 2D

I have a simple code that calculates the acceleration of a body every update of my simulation using the Newton's law of universal gravitation and the second law of motion. ...
0
votes
1answer
32 views

Python path finding

Im making a dungeon crawler in python, and I want to make it so that a certain enemy (only 1) will chase you through the dungeon the map is stored like this: [ ['0','0', '0'], ['0','0', '0'] ] ...
0
votes
0answers
23 views

Libnoise bounding box - from spherical to planar

I'm trying to convert a bounding box inside a spherical map (equirectangular image as a result of Libnoise/c++) into a planar projection, but I can't find the correct algorithm for it and I'm not good ...
0
votes
3answers
68 views

Finding an angle between two bodies

I am trying to find angle between vectors a and b. But the cosine for some reason is not within +/- 1, that means that it is not possible to find an angle between a car and a pedestrian... Any help ...
0
votes
0answers
19 views

Preserving original direction when collision changes direction

I have sliding for player characters and it's working, but running into a small issue. The original direction gets lost, and I'm unable to resume the original direction. My characters have a ...
1
vote
0answers
25 views

Which Python package/library is best for this kind of game? [closed]

I'm wanting to make a small scale version of the game Hearthstone and other 2d games that I can implement self-learning ai in. I was wondering which python GUI would be best to display them. It would ...
-4
votes
2answers
76 views

i don't understand what i am doing wrong. (line 29) [closed]

my problem is that i can't use elipse in line 29 ore someting like that. line 29 = elife player_choice == '2':
1
vote
1answer
34 views

Problem with diagonal collision response using PyGame

So I have been having this problem for the last few days and it has me really frustrated. What I am trying to do is resolve collisions with custom hitboxes in PyGame and it looks something like this: ...
0
votes
0answers
21 views

How to detect collision while the animation is running to move an object to the next coordinate?

I implemented SAT collision detection in Python with the GUI library pygame. It is working well, except when the objects are going too fast. I have velocity and acceleration variables. For each loop ...
1
vote
0answers
62 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
50 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
42 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
135 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
28 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
31 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
65 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
56 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
44 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
111 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
80 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
35 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
67 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
98 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
31 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
150 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
70 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
30 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
60 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
39 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
386 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
113 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
38 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
14 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
100 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
75 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 ...

1
2 3 4 5
10