Questions tagged [python]

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

Filter by
Sorted by
Tagged with
1 vote
2 answers
25 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 ...
Tiimzy's user avatar
  • 111
0 votes
0 answers
33 views

Full Unreal engine API support in Python?

I'm a newbie to the Unreal engine, and I've seen that there is very little documentation and examples of Python in the Unreal engine, so I'd like to ask if, leaving out the gameplay functionality, we ...
Haitao Xiao's user avatar
0 votes
0 answers
24 views

How to implement and understand Clipping

I am writing a 3D renderer from scratch in Python using PyGame and Numpy. I have the basics implemented, which are working well. I have noticed that when you get too near to objects, the objects ...
Matthew Haywood's user avatar
0 votes
2 answers
140 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 ...
Intice's user avatar
  • 31
0 votes
1 answer
53 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 ...
Baer Ran's user avatar
0 votes
1 answer
123 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 ...
anathrax's user avatar
0 votes
1 answer
55 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 ...
Lone's user avatar
  • 3
2 votes
1 answer
94 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 ...
Intice's user avatar
  • 31
0 votes
0 answers
26 views

Pygame showing surfaces at wrong coordinates with full screen

So I coded this line for the display surface: screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN|pygame.NOFRAME) But the thing is, when I place a rectangle ...
Le Guide Minecraft's user avatar
1 vote
1 answer
67 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 ...
anathrax's user avatar
0 votes
0 answers
159 views

PyOpenGL "Attempt to retrieve context when no valid context" - seems to be Linux specific?

I've been trying to learn PyOpenGL, so I'm still pretty clueless about what's going on. I've been following a video series. I couldn't get it to stop throwing "Attempt to retrieve context when no ...
brododragon's user avatar
0 votes
0 answers
95 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 ...
EarthAndMoon's user avatar
0 votes
1 answer
101 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
Tokyn Blast's user avatar
0 votes
0 answers
51 views

Decrease size of hitboxes for a sprite in PixelPAD

I need to make the hitboxes of spikes smaller, so that it's not impossible for the player to get through. How do I do that?
CK Development's user avatar
0 votes
0 answers
17 views

How can I halt a check for intersections of sets in python when it discovers one member of the intersection?

How can I halt a check for intersections of sets in python when it discovers one member of the intersection? I want to do this so that when checking for collisions the moment an intersecting point is ...
Nato's user avatar
  • 9
0 votes
0 answers
62 views

pygame.error: video system not initialized

I don't know what's going on when I try to run pygame this error occures everytime no matter how much changes I have made. HERE'S THE CODE: ...
opidas's user avatar
  • 1
0 votes
0 answers
49 views

Make pygame rectangle disappear when ball collides

So I'm doing a brick breaker game using Pygame. I want that everytime the ball hits a brick, that brick disappears (idk how) Here's my code: ...
LGM's user avatar
  • 1
0 votes
0 answers
108 views

How to send camera feed to Python script in Unity?

I have an image recognition code in Python and I need the input image to come from the Webcam in Unity. I've seen the Python Scripting package and the method of using a websocket and take the app as ...
Nicolas Cordoba's user avatar
0 votes
0 answers
28 views

Why doesn't my image and text appear?

This is my code in question: ...
David Tan's user avatar
0 votes
0 answers
64 views

Unable to load texture from temporary directory

I'm developing a game in Ursina. Since my old question did not get any answers, I decided to extract the zip file to a temporary directory and read the assets from there, but not everything runs well. ...
EarthAndMoon's user avatar
0 votes
0 answers
155 views

Ursina not applying shader and light to entity

I'm making a terrain-based game in Ursina. I finished making the terrain and the texture, and all of them run well, but Ursina is having problems with the lights and the shaders. ...
EarthAndMoon's user avatar
0 votes
0 answers
70 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: ...
EarthAndMoon's user avatar
0 votes
0 answers
148 views

WHY doesn't Python's Ursina module load textures from .mtl file?

Why doesn't the Ursina module directly load all textures from an obj's mtl file? Let's assume I have 4 files: test.py: ...
EarthAndMoon's user avatar
0 votes
0 answers
35 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: ...
Zoler1337's user avatar
0 votes
1 answer
130 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 ...
WinterPanda's user avatar
-1 votes
1 answer
293 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 ...
Umi's user avatar
  • 11
0 votes
0 answers
52 views

Where are the docs and api reference for Python's Bullet-for-Ursina lib?

Where can I find the docs the and api reference for Bullet-for-Ursina? I already searched things similar to "Python Bullet for Ursina docs" but with no success.
EarthAndMoon's user avatar
0 votes
1 answer
116 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 ...
Zoler1337's user avatar
1 vote
0 answers
58 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 ...
kingley's user avatar
  • 11
0 votes
2 answers
395 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: ...
EarthAndMoon's user avatar
0 votes
1 answer
131 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: ...
EarthAndMoon's user avatar
0 votes
0 answers
61 views

Why is my code giving an infinite while loop/crashing?

I have this large code that produces buttons that are meant to be clicked. ...
3141592654's user avatar
0 votes
1 answer
176 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 ...
Panda Pajama's user avatar
  • 13.4k
0 votes
0 answers
63 views

Creating a flattened (panorama?) 2D view of a cubemap

I am trying to generate a 360 degree view of a scene by sampling a depth cubemap using spherical coordinates. x and y represent the horizontal, or azimuth, and elevation angles respectively and the ...
marcos's user avatar
  • 1
0 votes
0 answers
102 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 ...
N3RDIUM's user avatar
  • 53
0 votes
1 answer
47 views

Why doesn't the fire appear when moving code to a function?

This is my code: ...
David Tan's user avatar
0 votes
2 answers
96 views

How do I get my character to move?

This is my code: ...
David Tan's user avatar
1 vote
0 answers
84 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 ...
thor625's user avatar
  • 25
0 votes
1 answer
89 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-...
thor625's user avatar
  • 25
-2 votes
1 answer
281 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 ...
c0der's user avatar
  • 1
0 votes
1 answer
284 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 ...
KianMckenna's user avatar
0 votes
1 answer
311 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 ...
sliders_alpha's user avatar
0 votes
0 answers
191 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 ...
Sad Strawberry's user avatar
0 votes
1 answer
168 views

Converting physics example to Velocity Verlet / Leapfrog method

I'm looking at the impressive video about verlet integration. I managed to implement a sphere falling, exactly like the video up to the minute mark 2:19 in the video. I want to use velocity verlet ...
nammerkage's user avatar
0 votes
0 answers
122 views

How do I reduce the size of a sprite hitbox?

I am making my own pygame game, but I want to reduce the size of the player's hitbox in order to make dodging bullets easier. ...
Kai van Loon's user avatar
1 vote
1 answer
51 views

Is it a good idea to solve movement of solid bodies with restrictions (e.g. connections) by shifting tangentially and projecting normally in phase sp?

I am trying to code my first 2d game with physics (in python), and so far my physics simulation works with solid bodies. I want to add connections, for example, so the player can rotate an arm and ...
Alexei Tsybyshev's user avatar
0 votes
1 answer
28 views

Load in all NPC asset dependencies at once, or Just In Time during their construction?

I have an NPC class with a DialogueTree object as a field. DialogueTree objects are ...
Michael Moreno's user avatar
0 votes
1 answer
339 views

for event in pygame.event.get(): pygame.error: video system not initialized

I'm going through a tutorial and trying to build a game using Python and struggling to resolve below error. Not sure what I'm missing here can someone help with it Alien_invasion.py ...
user14932992's user avatar
0 votes
3 answers
1k views

How to train a reinforcement learning algorithm in Unreal?

I know I can use ONNX plugins to use pretrained Deep Learning models in Unreal Engine 5, like style transfer, object detection, etc. I want to build a basic reinforcement learning project and would be ...
Devanshu's user avatar
0 votes
1 answer
511 views

Having trouble trying to figure out why pygame.sprite.Group's draw method isn't working properly, but switching to player sprite does work

Goal, Description & Scope (when encountered issue) I was building a testing script to see how implementing different ideas (event handling, update handling, draw method) to loading sprite images, ...
DracoDaine's user avatar

1
2 3 4 5
13