Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [python]

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

0
votes
1answer
26 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
0answers
27 views

Problem with water distribution in hydraulic erosion simulation

I'm trying to implement in Python the hydraulic erosion simulation presented in this paper (Jacob Olsen, Realtime Procedural Terrain Generation, 2004) but am running into an issue at step 3 of the ...
0
votes
0answers
11 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 the collisions but when I add an object to the group, I get an error in sprite.py in Pygame's files: ...
2
votes
0answers
36 views

What is the correct way to compute the gradient of a height map?

I'm trying to implement in Python an algorithm for hydraulic erosion based on this post. For the first step I need to compute the gradient of the terrain height to determine where water and sediment ...
-1
votes
0answers
25 views

“Video system not intialized” error

When I run the following code, I get the error "Video system not initialized" What does this mean, and how can I correct this error? ...
0
votes
1answer
18 views

player movements aren't working python

from pygame.locals import import pygame import math from time import sleep import display_world class Player(pygame.sprite.Sprite): class Player(): x = 10 y = 500 speed = 10 ...
0
votes
1answer
40 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
49 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
50 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
53 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
49 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 ...
0
votes
1answer
42 views

Finding Closest of 8 Possible Angles to Theta Value

I'm working on creating a gesture recognition system, and I saw one simple implementation that isn't as accurate, but is really easy to implement. The idea is that you have a unit circle with the 8 ...
0
votes
1answer
30 views

Collisions in other sides on pong in python

Im trying to create pong in python, so far Ive set up correct collisions on the right paddle but upon just trying to reverse the code to work with the other side it refuses to work, simply glitching ...
0
votes
0answers
51 views

Why doesn't my pygame window close on MacOS?

I am trying to create a window and then close the window. Everything runs smoothly until I click the red X. When I click it, the window doesn't close and all that happens is that the colourful red ...
0
votes
0answers
25 views

Wii accelerometer data ranges

I have 2 related questions, please. I am using a wiimote on a robotics project and I need to convert X and Y values into new bounded values. So, give the following accelerometer data: ...
2
votes
2answers
117 views

Generating different maps using Perlin Noise with a seed

I am developing a 2D game in python and I could get Perlin Noise working with this code: ...
2
votes
1answer
62 views

Perlin Noise generation always returning zero

I am using noise and I can't get Perlin Noise working, only the Simplex Noise. So far I got this: ...
0
votes
1answer
31 views

Python: I have a python statement which should work but it doesn't [closed]

The error in the picture is highlighted in red. So, I have used this code on another computer and it worked, why wont it work now? I may have made a really small and stupid error and if I have I'm ...
0
votes
1answer
26 views

Determining which way a wall faces in a 2D grid with minimal boilerplate

I have a 2D grid of quadrilateral tiles, some of which are walls, some are floor; each tile has four vertices, which are shared with the tiles around it (so each rendered "wall" is at least two wall-...
0
votes
1answer
49 views

Getting event types in Pygame

I want to have the type of an event from the event queue to decide certain actions (i.e. if it is a joystick event or a keyboard one), but the dir of events is an ...
1
vote
0answers
95 views

Python:Adding enemies and weapons in game (Text-based adventure game)

I'm a beginner in coding and game-design also and try to make text-based adventure game, where player should move between rooms, fight with zombies and pick up weapons. Any help, namely tips and ...
1
vote
1answer
157 views

How to resize a surface in Pygame?

How can I resize a Surface object in Pygame? Is there a way to bind a surface object into a Rect object, so that resizing the ...
1
vote
1answer
64 views

How to get camera to follow car

i am making a top down racing game where the car progresses along the track, however i need the camera follow the car as it progresses through the track. I am unsure how to fix the error. I am new to ...
0
votes
2answers
126 views

Pygame platformer - Making sprite jump

I am currently trying to make a Mario-type platformer using pygame and the MVC design pattern. My progress as of right now is getting a character on screen and having it move left and right. My goal ...
2
votes
0answers
54 views

Non-Perfect maze generation with objectives [duplicate]

I need an algorithm that can generate mazes with these requirements: Allows for random structures to be made (Ex: a center spawn area, objective points and 'Caverns (corridors with 2 or more ...
0
votes
1answer
51 views

processing request in order on game server

I am creating a simple multiplayer puzzle game in which multiple players can join a lobby and compete with each other. the player that submits the answer first gets the highest point, the player that ...
0
votes
1answer
143 views

Using PyOpenGL, can I rotate raw data rather than the current matrix?

I'm trying to create a sort of PyOpenGL renderer for the Bullet physics engine, and at the moment I'm rotating my basic cubes with math in Python. However, if I do the math in Python that's going to ...
0
votes
1answer
47 views

First “If” Enemy Selection Function being recognized as a syntax error in Python

I have an issue with trying to under the syntax error with the line if enemy_select = 1: in this type of code: ...
3
votes
1answer
438 views

Adding character stats/traits in Ren'py

I'm coding a relatively simple VN with RPG elements in Ren'py, with little prior programming knowledge. There's one aspect that I can't simplify further because it's important to the game's branches, ...
2
votes
1answer
128 views

Pathfinding, 2+ tiles wide

I recently started learning python and I'm working on a dungeon generator, using images for the rooms, hallways and junctions. Example of desired result. So far I managed to generate a X * Y map and ...
0
votes
2answers
144 views

“RuntimeError: Validation failure (0)” using shaders

I'm trying to move away from using glVertex() in my game code because it doesn't seem to work well with a large quantity of vertices. At the moment I'm trying to make code that uses Shaders, but when ...
-1
votes
1answer
129 views

Converting code to work in godot with sliders

I have some Fragmentarium code that I would like to convert so it will work in Godot anyone have any ideas how I can do this? The code is below: ...
1
vote
0answers
117 views

How do I create a HeightField in pybullet?

I've been looking for documentation on PyBullet, the python implementation of Bullet, but I haven't yet found a way to implement the btHeightfieldTerrainShape collision object, which I need to make, ...
0
votes
2answers
206 views

maya script editor: how to keep python code after execute

see my gif, in script editor, I hope keep python code after code is executed and run it again next time, how should i do?
0
votes
0answers
86 views

The websocket messages in my online game are being served too slow

Im attempting to make a online game in python, though I have ran into a problem. Basically I want the game to be playable in many regions, but the websockets are to laggy to be played in farther ...
0
votes
1answer
42 views

Terrain Rendering/Update Failure Python 3.x

I have begun to create a procedurally generated RPG using Python, and I am having trouble with rendering the terrain. What is happening: I generate some terrain from some files, or create/save new ...
0
votes
0answers
60 views

Kivy - Why are .kv files preferred to drawing in python?

I'm trying to get a game I'm working on in python running on Android, so I'm learning about Kivy, which is very simple to build. It's currently all in pygame, drawing and blitting to surfaces and ...
1
vote
2answers
110 views

Trouble creating a “Game Log” for a text-based RPG

I've made significant progress porting my game from print-output to Pygame over the last few days, and I think I'm almost there! Unfortunately, I'm beginning to suspect one of the methods I'm using ...
-1
votes
1answer
55 views

Having trouble making more than 1 clickable object

I am a student trying to figure out how to make multiple clickable objects in pygame. I was able to make 1 working clickable object (dx,dy) work, but when I tried to make another clickable object (qx,...
0
votes
1answer
88 views

How do I port a game which uses print-output to pygame font rendering with the least amount of work?

I've been working on a text based RPG. It's pretty simple, I'm not very experienced with Python, or any other language for that matter. Edit: For context, I recently posted this question: Python 3: ...
0
votes
1answer
250 views

Python 3: How can I make my Text-based game windowed?

I've been making a text-based RPG in Python, and I'm a bit lost in transitioning from a console to a window. I'm not trying to do anything fancy (I think). I'd like my text to display normally, as it ...
0
votes
1answer
71 views

How do I let game maker know that recieved json data is an array?

In python I created an array called lobbyList = ["Awesome","Funny","Epic"] I sent this array to Game maker studio 1.4 using JSON, I made a variable called ...
1
vote
0answers
378 views

IronPython with Python in Unity: How should I manage dependencies Python-side?

I am currently trying to get Python working in Unity, and I was wondering how would I manage dependencies on the Python end. For example, say I have a Python script with the following dependencies: <...
1
vote
1answer
1k views

Using CNN's in Unity via Tensorflow and TensorFlowSharp

I have a project that tracks hands made in python, shown here: https://github.com/timctho/convolutional-pose-machines-tensorflow I want to effectively import this into Unity. I have generates the ....
1
vote
0answers
112 views

Pygame collision

I'm making a dungeon game, and I'm making the collision system. There is an object obstacle, which has got these properties: ...
4
votes
2answers
167 views

Simple 2D games - what is faster to render - images or drawing?

I am developing simple 2D environment in Pygame (Python 3.6), however I think this question is general. The environment is moving (player is rendered on the same position and everything else is ...
0
votes
0answers
82 views

Performance issue for simple pong game in pygame

I have made a simple pong game in pygame, where enemies and items fall down. However, even though it runs at 60fps, it stutters really often which leads to the game being annoying to play. I have ...
1
vote
1answer
515 views

How can I move a vehicle using speed and steering angle?

I want to drive a vehicle in x and y coordinate area with range from (0,0) to (6000,5000). I am using Visual Components (using Python API). On input I have speed data and steering angle of wheels ...
0
votes
2answers
202 views

How to move a sprite quickly whilst animating it?

At the moment I am creating a program in Python, and Pygame, similar to Fire emblem, so a game that has a tile based system in which the sprites use to move to and determine location. I have been able ...
1
vote
1answer
174 views

How can I add 3D animation to my Pygame window?

I've developed a quiz game using Pygame but now I'm being asked to implement a 3D animation element (a game show host) to the game. I used Pygame as I was told it would be an easy enough language to ...