All Questions
16
questions
2
votes
2
answers
352
views
Movement and collision function
I just want this code optimized to the max and I don't mind knowing if the optimization is pretty much at the max already or if I am doing movement and collision wrong. My game is a 2d Minecraft style ...
2
votes
1
answer
363
views
Simulation of sand particle collision
I am making a module that allows you to create sand and simulate it. I have successfully done this, but it runs very slowly. I need this to be able to simulate at least 1000 particles, at a fps higher ...
4
votes
2
answers
289
views
Revised Top-Down Dungeon RPG
Introduction:
So far, the game works well, and my only major concerns, are a bullet system (including a function where you click the mouse to shoot the bullets), and a collision system between the ...
5
votes
1
answer
2k
views
Python - 2D Elastic Collision Simulation
I am currently a Python beginner, who just finished a script simulating collisions between circles (balls) in 2 dimensions.
I would appreciate comments on overall structure, variable names and really ...
5
votes
2
answers
10k
views
Python Turtle based Pong game
I'm new to Python but I've coded in other languages mainly for hardware. I made Pong in Python using turtle but it's a little glitchy. I was wondering if any of you guys could check it out and give ...
5
votes
1
answer
50
views
Mutable 2d Rect class
So I wrote a 2d rectangle class for use in a 2d pygame based game engine. It uses the vector class from this question, so if you want to test, you need that code too. I want to ask: Does this ...
3
votes
2
answers
737
views
Maximize the number of PyGame sprites, with collision detection
I was trying to see what is the highest number of moving and colliding boxes (sprites) I could get in pygame? So that I could start working on game I want, I searched google and I found different ...
3
votes
1
answer
1k
views
Simple geometry problems involving rectangles and circles in Python 3
I'm working with some simple geometry problems featuring rectangles and circles. My code is as follows:
...
6
votes
2
answers
864
views
Computing intersections of a Polyline and a line
I wrote a script to compute / interpolate the nodes of a Polyline at a given latitude, input_lat. It works for my purpose but I am wondering if there is a better, ...
15
votes
3
answers
836
views
Setting the scene for a role-playing game
I made some games in Pygame, but I am still new to making games.
I made this RPG game, and this code is just a part of the game. The game executes different Pygame files for different levels of the ...
1
vote
3
answers
5k
views
Collision detection algorithm
This is my second algorithm and I will try to make it as simple for you to understand how it works. It is pretty expensive and I'd like to make it more efficient.
.
It works by splitting a square ...
9
votes
1
answer
13k
views
Line segment to circle collision algorithm
I've written a function (in Python 3) which computes if a line segment (constraint) and a circle (body) collide, and returns the point of intersection (closest point to the centre of the circle):
<...
7
votes
1
answer
3k
views
Implementation of SAT (Separating axis theorem)
A project I was working on required the usage of the Separating Axis Theorem to detect collisions between two convex polygons in real time. So I implemented a basic class (...
9
votes
3
answers
2k
views
Performance of collision detection in a grid
I have fairly simple collision checking and handling Python code which is currently bottlenecking my performance quite a bit. I haven't done too much coding in python and I'm quite sure there's ...
32
votes
3
answers
44k
views
Overlapping rectangles
I received the following question in a technical interview today (for a devops/SRE position):
Write a function which returns true if the two rectangles passed to it
as arguments would overlap if ...