Questions tagged [python]

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

Filter by
Sorted by
Tagged with
1 vote
1 answer
56 views

Model path of bullet to hit future position of balloon

I am coding a Bloons Tower Defense Game and one of the problems I have is how to shoot a projectile from a tower and have it hit a balloon that is moving along a certain path. The way I am currently ...
user avatar
0 votes
0 answers
30 views

How can i make multi-line dialog box?

I'm trying to make a dialog box with pygame, and initially everything was going well. I printed the letters sequentially on the screen and it works very well in a single line of text, but when I use <...
user avatar
0 votes
1 answer
39 views

How to extract the largest mipmap of a DXT5-compressed VTF file?

I'm trying to programmatically convert the largest mipmap of a 32x32 DXT5-compressed VTF file to a PNG. Here is what the image should look like after conversion: And here is what mine looks like: ...
user avatar
-1 votes
2 answers
71 views

Error when creating random buttons

...
user avatar
1 vote
1 answer
39 views

Using collision with classes in pygame

I am trying to make some games using classes. But I got a problem when trying to make the ping pong game. I made 2 paddles and a ball but I just do not understand how should I make the collision ...
user avatar
  • 15
0 votes
0 answers
27 views

Python GLFW and PyOpenGL: How to update a VBO from a thread while rendering at the same time

I'm really new to this community. I'm sorry for any mistakes in advance.I'm making a game like minecraft with GLFW and OpenGL. The problem is, I just can't render a VBO while I update it from another ...
user avatar
0 votes
0 answers
12 views

Is there any way to compile a python script to web like unity webgl [duplicate]

I've been working on a game in pygame for a while and decided it was too much of a hassle to compile it to all the operating systems. So, naturally, I turned to the web. While I am well aware that you ...
user avatar
0 votes
1 answer
27 views

How to play a sound when changing the value of a tkinter scale

I'm making a settings menu for my game, and would like to know if it is possible to play a sound every time a value of a scale is changed. For example, the user changes the scale from 1 to 2, a sound ...
user avatar
0 votes
0 answers
31 views

Not being able to display pygame.freetype text

I'm trying to make a game where the player has to dodge asteroids coming, and I'd like to display the lives. I looked up some tutorials and decided to settle on pygame.freetype. When I run the code ...
user avatar
0 votes
1 answer
69 views

How to properly set up a lives system for a side-scroller in pygame

I have a game where the player has to dodge asteroids coming towards it, and I would like to incorporate a life system. Unfortunately, when I tried this, it still killed my player immediately. I ...
user avatar
0 votes
1 answer
104 views

1920x1080 Image don't fit to 1920x1080 screen

I'm making a game with pygame and I wanted to add a background for my game. I'm trying to add a 1920x1080 background to a 1920x1080 screen, but part of the background is not visible. My code: ...
user avatar
0 votes
1 answer
75 views

pygame only moving when moving mouse

Every time I press the left or right arrow keys it moves a little however when I wiggle the mouse around while pressing the keys the player flys across the screen for no reason. I'm following ...
user avatar
  • 1
-1 votes
1 answer
29 views

The vector aiming to enemy is in wrong direction

In a 2d game, I am trying to shoot at a moving enemy and the vehicle that is shooting is also moving. However, the velocity of the bullet is not in the same direction as the position of the enemy. The ...
user avatar
0 votes
0 answers
10 views

aiming prediction in 2d game using projectile [duplicate]

I am trying to make an agent predict the velocity required to throw a ball at a target and take into consideration the target. So what I need is a ball following a projectile path until it hit the ...
user avatar
0 votes
0 answers
26 views

How to merge multiple fbx animation files?

How can I merge multiple fbx animation files into one longer file? I have set of humanoid animation files in fbx format, and am looking to have them all in one longer animation file (fbx). I tried the ...
user avatar
0 votes
0 answers
45 views

How to use glLookAt() to rotate around an object orbit

I've been struggling with a school project in which I'm supposed to create a camera like the one in Blender. One of the steps I need to implement is to make the camera rotate around an object's orbit ...
user avatar
  • 1
1 vote
1 answer
41 views

Optimizing overlapping units vision calculations in RTS using PyGame

Currently I'm developing a RTS game using Python/PyGame and I got some problems with fps drops when there are many units on the screen. Using Snakeviz profiling I found out that the function ...
user avatar
1 vote
1 answer
48 views

How can I implement an algorithm to mix potions?

I would like to build something that allows me to obtain potions using two identical lists of ingredients. ...
user avatar
  • 257
0 votes
1 answer
106 views

Is there a way to make a game that uses Python/pygame that will work through a web browser?

Is there any framework or method that will allow to use browser to run a 2D game made in python with pygame graphical library?
user avatar
  • 123
0 votes
1 answer
31 views

How to generate reliable labels for game state using Python and Pygame

I've been looking into making a small game where you would walk around and do puzzles (perhaps do some combat if I can get the basic framework going). So far, Googling for general game patterns used ...
user avatar
1 vote
0 answers
128 views

Circle and circle collision (with physics), but when lots of circles pile up things go wrong [closed]

I'm trying to make an as realistic as possible ball physics simulator. Currently, I worked out all the collisions between balls, and it works really well when there are few balls. But once you create ...
user avatar
0 votes
0 answers
69 views

Unity using python 2 on webgl build

When exporting my game for web-gl with unity(2020.3.31f1) on osx (Monterey 12.2.1) I get a warning that python 2 was sunsetted in January 2020. What should I do? Wait for the next Unity LTS release ...
user avatar
0 votes
1 answer
215 views

Collision detection between moving objects (in pygame)

I am trying to work out how to detect and resolve collisions between moving sprites in pygame, I followed the logic of this video: https://www.youtube.com/watch?v=VpSWuywFlC8 The basic idea is that I ...
user avatar
0 votes
1 answer
27 views

Converting mesh vertices to world coordinates for raycasting

My goal is to figure out if a point exists within a 3D polygon. To do this here is what I am doing: Load obj mesh ...
user avatar
  • 101
0 votes
1 answer
70 views

How do I change only the angle of a certain PNG relative to the position of the mouse? (Python, Pygame)

Basically, I'm doing a game for a school project and I am not really sure how to make a player point towards the mouse pointer in a pygame tab. also if anyone has ideas of how i could point a bullet ...
user avatar
0 votes
0 answers
98 views

What is a good method for 2D isometric lighting in Pygame?

I'm making my first isometric game in Python using Pygame. It's a 2D tile-based dungeon crawler, but I want to create a nice lighting system. I've made a random level generator that creates the rooms ...
user avatar
  • 101
3 votes
2 answers
109 views

How do I store a branching board game path in python

I thought a fun way for my son and I to learn and improve our python programming skills respectively is to digitize one of his (and my and my mom's when we were his age) favorite board games, "...
user avatar
  • 33
1 vote
0 answers
45 views

How do I make a 'surface' using pyglet, like in gamemaker studio?

For a project I've been working on, I need to know how to draw to a surface/texture/whatever, that could be used as a texture for binding to a vertex list. I'm fairly new to python/pyglet, and couldn'...
user avatar
2 votes
0 answers
27 views

Pygame RESIZABLE display flag not working as expected on display re-initialization

I'm working on a simple script to be used as a personal code skeleton for pygame projects (making this primarily for practice with Python, PyGame, and game design) but I'm running into an issue with ...
user avatar
0 votes
1 answer
96 views

Pygame : having trouble with implementing movement with vectors

I've been struggling a lot to learn how to use vectors in programming. Now I've successfully made my own vector class but I still can't use vectors for movement. This is my class : ...
user avatar
  • 216
0 votes
0 answers
57 views

How to make player shooting?

this my code ...
user avatar
  • 1
0 votes
0 answers
100 views

Ursina Engine shaders not supported

Ursina shaders don’t work for me. I’m running Ursina 4.1.1 on Python 3.8.5 on macOS 10.15.5. Shaders I tried: lit_with_shadows_shader screenspace_shaders.fxaa_shader screenspace_shaders.ssao_shader ...
user avatar
  • 257
-1 votes
1 answer
89 views

Create list of objects with a for loop pygame/python

Hi everyone I am trying to make a Mahjong Solitaire game using pygame. I want to create a list of objects (the tiles of the game) using a for loop, but I can't manage to set a different type (the ...
user avatar
0 votes
0 answers
71 views

Problem trying to detect input focus pygame

I am currently creating my version of the classic "Snake" game from scratch. I have added code that creates a dialogue box using the Tkinter module, allowing the player to choose whether or ...
user avatar
  • 1
0 votes
1 answer
64 views

Internal representation of checkers board

I am creating a game of checkers using the but am struggling to find a good internal representation for the game. My initial thoughts were to store the game board in a 2d list, with 0=empty, 1=always ...
user avatar
-2 votes
1 answer
39 views

My python code has stopped detecting keystrokes

It was working before, then I added the enemy rectangle and it has stopped working. ...
user avatar
0 votes
0 answers
44 views

How to make a multiplayer game for multiple screen sizes?

I am making a 2d multiplayer game for Android, targeted to run on every device. How do I calculate the common position of an asset, independent of screen size? What size map should I assume is a ...
user avatar
0 votes
0 answers
89 views

python open .obj file that doesn't have normal information stored

I want to open an .obj file using retcave. Here is the code I am using: ...
user avatar
0 votes
0 answers
73 views

Integrating gpt2 into unity

I was wondering if anyone had any pointers in integrating gpt-2 into unity. I've got quite a bit of experience with python, but less with unity. What I'm trying to do is use a pretrained gpt2 model in ...
user avatar
-2 votes
1 answer
298 views

How do I port a game made with Scratch, Pygame, or JavaScript to the Switch?

I've been making my own games in many different languages (mainly Scratch, Python 3 with Pygame, and JavaScript), but, so far, none of them have been ported to the Nintendo Switch. How can I do this?
user avatar
0 votes
0 answers
340 views

Entity Component System in Python

Me and a team of junior developers are making a role playing game. We would like to make something similar to https://bunk.town/ I have only made a Tetris clone which doesn't require much knowledge ...
user avatar
0 votes
0 answers
41 views

Implementing growth in Snake?

I'm new at this, so I thought I'd start simple. Snake. I started with pygame, just looking some things up, and I've now got movement, random fruit generation, and a score counter. ...
user avatar
0 votes
1 answer
140 views

Unable to restart level in Python Pygame

So, I am making Flappy Bird and when the player dies I have the spacebar assigned to reset the game. However, it's not working and I truly have no idea why (after like 3 hours of going through ...
user avatar
0 votes
0 answers
83 views

How to draw player from the bottom up [pygame]

so I have this basic game I made with pygame, in the game I have this player sprite: which is 16x28, problem is: all other sprites in the game are 16x16, so I want the player's hitbox to be 16x16 as ...
user avatar
0 votes
0 answers
34 views

effect and ability activation in state system?

First time that i am making a text based card game, the main code here is starting to feel a bit clunky.This is a turn-based/phase based system where an effect/ability activates in a specific state/...
user avatar
0 votes
1 answer
59 views

How to blit a surface onto an already blitted surface in Pygame?

Consider the following code: ...
user avatar
1 vote
1 answer
73 views

How do I create an event trigger system for a Discord bot?

I am making a card game and I am having issues implementing "effects" and effects that are continuous. How can I get effects to activate at the right times, before and after an attack does ...
user avatar
0 votes
0 answers
38 views

Minimax algorithm seems stuck in infinite loop, please help!

2 players works fine but I can't debug the minimax algorithm, it just keeps going.. sorry that the code is messy ...
user avatar
0 votes
1 answer
58 views

Recycling bullets versus spawning them on demand

Until now, I know 2 bullets' algorithms/configurations : (I mean 2 ways of logically creating a bullet class) Make a bullet class and create only one instance from it that represents the bullet. The ...
user avatar
  • 216
0 votes
0 answers
76 views

3D to 2D transformations with numpy

I am trying to create my own game in the python terminal, but I just can't find something I can use in python. I found something on https://www.gamedev.net/forums/topic/59091-projection-matrix-amp-3d-...
user avatar

1
2 3 4 5
12