Questions tagged [python]
Python is a dynamically and strongly typed programming language that encourages readability.
635 questions
0
votes
1
answer
48
views
Applying greyscale shading to objects in a Python 3D renderer
I need help with how to apply greyscale shading to objects in a 3D renderer I made in Python. The code is pasted below:
...
0
votes
0
answers
36
views
Meshes are not visible after adding them to an actor scene component
I wrote a Python script (for the editor) to attach a mesh to a scene component of an actor (vegetation_root_component).
In the logs everything looks fine, but no ...
0
votes
0
answers
21
views
How do I make smooth 2 way shooting in pygame? [duplicate]
I have been trying many thing to make my code work to make a player shoot a small box both ways (left and right) without being able to change the direction of the projectile mid shot.
I would be very ...
0
votes
0
answers
102
views
How do I create a shooting tool that works on both sides?
I am a fairly new user of pygame and i decided to start out with a simple but 'funny' game.
I have successfully implemented jumping mechanics, movement mechanics and a one directional shooting ...
0
votes
1
answer
143
views
Can I Create a Camera System in Pygame Without Using Classes?
I am working on a basic side scroller platformer in Pygame. I want to add a camera system that tracks the camera and scrolls the world and I want to make the camera systems without using Classes. ...
1
vote
1
answer
90
views
Pygame display.Info() / fullscreen not working under Linux
I am experiencing some issues with pygame.display.Info() and the FULLSCREEN property on Linux. The game is displaying at roughly ...
0
votes
0
answers
58
views
How to use sensors and ray casting for collision detection in Pygame (using a custom Mask/sensor class)?
I am making a Sonic game in Pygame and I have recently gotten my hands on a Python class that uses pygame.rect and pygame.mask in unison to create sensors that can be used to accurately detect the ...
1
vote
0
answers
84
views
How to handle collision events in games with multiple interactive objects?
I'm developing a 2D game where multiple types of objects interact with each other through collisions. Currently, I'm using pygame.spritecollide() to detect ...
0
votes
1
answer
199
views
Score counter in Python game assigning points to both players
I am trying to learn to code a simple game with 2 players shooting at horizontal-moving enemies from the bottom of the screen.
Everything is working fine except for this:
When player 1 hits enemy ...
0
votes
0
answers
60
views
Is this numerical cellular automaton an efficient way of simulating water or smoke?
I'm not a game dev. However I've just created what I believe may be an original means of creating realistic-enough water or fire/smoke textures, which may perhaps in principle (and using a different ...
0
votes
0
answers
51
views
Video editing/editor in Godot or use Godot animations for video editing in Blender Video Editor or elsewhere
I found it very nice and easy to make animations in Godot and it allows you to generate animations using programming, which is marvellous. You can animate the movement of a text with a complex ...
0
votes
0
answers
139
views
How can I improve vector collision algorithm?
I'm making a game (shocker) in pygame and had issues with tile-based collision detection. There are 5 different non-empty tile types (pictured below) which can be rotated in increments of 90 degrees ...
0
votes
0
answers
58
views
Raspberry Pi Live data to Unity through Ethernet connection
I have a gyroscope storing data on a Raspberry Pi 4 (The Client) and I need to send this data to Unity C# (The Server) so I can use a gyroscope to control position data.
I have two separate devices I ...
7
votes
3
answers
2k
views
How do you determine what order to process chained events/interactions?
I'm trying to write a top-down tactics RPG game in python, and run into the first major decision I can't make with my limited knowledge of RPG fundamentals.
In our game you create a team of characters ...
0
votes
1
answer
97
views
How to get X and Y pixels of a Image in SDL2?
I am trying to create a Voxel Space Engine In SDL2 C++. However the tutorial I am following reads the X and Y pixels of the heightmap image. I can't find a way to do this.
I am following this tutorial:...
1
vote
1
answer
120
views
Reading steering wheel events has 180 degree dead zone. How to remove/reduce dead zone?
I'm making a GUI that can be controlled by a steering wheel. It need only run on Windows.
It works as expected with exception of the fact that the first 90 degrees in either direction seems to be ...
1
vote
1
answer
112
views
Connecting Isolated Paths in Randomly Generated Maps
I am new to game development, I previously created games using tiledmap editor and pygame, but manually creating map was real pain, so i begun to look how can i procedurally generate map, after ...
0
votes
1
answer
78
views
Frustum Culling Not Utilizing Entire Bounding Sphere in OpenGL
My frustum culling is detecting an object as culled even though not the entire object's bounding sphere is out of the frustum yet. It's like it believes the bounding sphere's radius is smaller than it ...
0
votes
0
answers
66
views
How can I change checkers pieces to move only horizontally and vertically?
I am a beginner level programmer trying to learn Python. I could not figure out how to change the values so I can restrict the pieces of checkers from moving diagonally. I want them to be able to move ...
0
votes
0
answers
63
views
1
vote
1
answer
86
views
Player not sliding on the side of a wall when two keys are pressed
I am making a game right now, and I am working on collision for different Rect walls (all of their data is stored in a list). It works great, except for one problem:...
0
votes
0
answers
456
views
Collision between a sprite and a rect in PyGame
I'm trying to make a simple platformer game, which has code to move the camera towards a player as they jump around.
Now I have two classes: one for the player, and one for the platform.
In the ...
0
votes
0
answers
73
views
How offset is working in UE5.3 Rigging editor
How to get local offset of a control with Python in UE RigEditor? I’ve found a function to get global offset unreal.RigHierarchy.get_global_control_offset_transform ...
2
votes
2
answers
189
views
How to stop moving a sprite if the user is holding down the opposing moving key at the same time?
I am new to creating games with graphics, and I want to make a very hard game. I have the movement down, but it has a weird bug where it if the user presses down the opposing movement key (i.e. A is ...
0
votes
2
answers
318
views
Infinite scrolling with mouse
I know we're able to scroll a background image hardcoded or using awsd keys(or arrows) if they're pressed. But what about scrolling it with mouse movement? So I have a piece of panoramic image as a ...
0
votes
1
answer
144
views
How does bullet physics filter 4+ contacts in GJK?
If the bullet GJK (Convex vs convex) collision algorithm has more than four penetrating points, then how is it filtering that down to the four it needs?
What I've tried
Staring at the code, but I get ...
0
votes
1
answer
686
views
Pygame code/file structure
I am currently working on a Pygame project and would like to seek your advice on best practices for organizing my code, particularly when it comes to creating additional scripts. I find myself ...
0
votes
1
answer
104
views
Sprite chasing a target using move_towards_ip does not move
I'm trying to get a turtle sprite to chase a falling algae sprite utilising Pygame's inbuilt functionality. I have spent many hours reviewing questions and answers and suspect I'm missing some ...
2
votes
1
answer
317
views
How do I mix an image with a specified color?
I have some images of static objects using per-pixel alpha (trees, rocks) for a background. In order to make them look a bit more natural, I want to create some kind of atmospheric fog, which means ...
1
vote
1
answer
108
views
Selecting Tiles Correctly With Scroll
I would like to understand the process of selecting the correct tile from a scaled Surface when I have information about the number of tiles on the x and y axes, the length of the Surface, and also ...
1
vote
0
answers
387
views
Programmatically get FPS in Ursina
In Ursina, how can I programmatically obtain the current FPS count as number (like extracting it from the fps counter in the upper-right corner)? I need this for phyiscs calculations in Ursina.
I have ...
0
votes
1
answer
434
views
Sprite Animation in Pygame Zero
How do I use a sprite sheet in pygame zero?
The height of the images are 32, width is 25
0
votes
0
answers
131
views
How to load asset from zip file?
How can I load an asset (model, texture, etc.) from a .zip file in Python's Ursina module without extracting it?
I tested this code:
...
0
votes
0
answers
78
views
Perspective projection distortions
I'm building my own engine using python and pygame however my cube model is not able to be displayed correctly. This is my result after applying translation, scaling and projection matrices:
...
0
votes
1
answer
348
views
PyGame moves object in one direction but not in the opposite one
I'm having trouble with a PyGame animation I'm writting. I have a Ball class that defines an object that moves on the screen and bounces on the edges. I initialize ...
-1
votes
1
answer
984
views
"End of line expected" error preventing me from opening game
I wanted to open my game to check that everything is working properly, but whenever I try to open the project, it redirects me to the script instead. This is the message below:
I'm sorry, but errors ...
0
votes
1
answer
235
views
Perspective projection not working as intended
I copied a perspective projection matrix from here (https://jsantell.com/3d-projection/) and applied it to my vertices. It looks ok but without depth. Rotation matrices also work.
When I try to divide ...
1
vote
0
answers
204
views
Problems with RayCasting after fixing fisheye distortion
I am writing a pseudo-3D game in Python. After I tried to fix the fisheye problem, a new one appeared - if you stand close to the wall and look so that the wall is on the side, then the borders of the ...
0
votes
2
answers
858
views
Python ursina\mesh_importer.py: AttributeError: 'str' object has no attribute 'glob'
I'm making a weather simulator with Python's Ursina engine, but I cannot load models.
The error stack:
...
0
votes
1
answer
287
views
Double trouble with Python's Ursina 3D engine
I'm making a weather simulator with Python's Ursina module, but the script crashes with two exceptions.
Console output:
...
0
votes
1
answer
450
views
How to convert a Unity transform to Maya's coordinate system?
I created a level in Unity, and I want to place some of the level objects in Maya so I can create an animation based on these objects.
I can import the model FBX with no problems into Maya, but if I ...
0
votes
0
answers
208
views
How to extend a VBO in OpenGL and keep its data?
I'm making a game with infinite, blocky procedurally generated worlds in python, with PyOpenGL. I figured out that allocating all the VBO space at once causes a lot of lag. To fix this, I am ...
0
votes
1
answer
90
views
Why doesn't the fire appear when moving code to a function?
This is my code:
...
0
votes
2
answers
278
views
How do I get my character to move?
This is my code:
...
1
vote
1
answer
257
views
Pyglet TextEntry not Working
I have been trying to make a simple game, and have recently been trying to work on a menu system for it. I am trying to insert a TextEntry box using the examples they have provided themselves.
I have ...
0
votes
1
answer
363
views
Pyglet.gl has no attribute glTranslatef
I have just started working with pyglet trying to make a simple game as a hobby. However, I have run into an issue. I am working with this demo:
https://github.com/pyglet/pyglet/blob/pyglet-1.5-...
-2
votes
1
answer
754
views
How to randomize all the colors to different colors every time the snake eats and grows?
I'm new to python and am making snake for a project/ I'm not sure how to randomize all the colors to different colors every time the snake eats and grows. I've looked up multiple things and nothing ...
0
votes
1
answer
638
views
Variable not updating while program is running
I am having issues where the variable action_cooldown does not update. I could remove this but then both the player and enemy attack at the same time, which is something you do not want in a turn ...
0
votes
1
answer
902
views
How to get better performance with pygame?
I'm not a gamedev, I'm a API/Cloud dev, performance has never been an issue for me since most of the time we are limited by network calls.
I've been playing with that for the past 2 days, I wanted to ...
0
votes
0
answers
461
views
Python Generating a Shadowmap from a Heightmap
I've recently been experimenting with Python and PIL to generate heightmap images using simplex noise. The generated heightmaps are simply 2D numPy arrays with height values ranging from 0-1. I ...