Skip to main content

All Questions

Tagged with
9 votes
1 answer
1k views

Generate unique random strings considering collisions

I'm coding a random strings generator. It's working, but I'm not sure if this is efficient. ...
user2652379's user avatar
2 votes
1 answer
68 views

Creating restrictions for a sprite's possible position on the screen

The great feedback I got on my first post on Code Review made me wary of code repetition. This code does what it is supposed to, which is to create restrictions for a sprite's possible position on the ...
ola_bandola's user avatar
0 votes
1 answer
76 views

Self Updtating QuadTree

I'm making a simple 2D game engine, and to make collision detection more effective I tried making a QuadTree class. I don't know if this will work, but that's not that important. You don't have to ...
Kristóf Bácskai's user avatar
6 votes
2 answers
962 views

Collision Detection in a 2D shooter game

I have the following code that works just fine for collision detection. The only problem is its size and its performance. I'm trying to do it and many other things 60 times per second, which doesn't ...
Plqsmic's user avatar
  • 197
6 votes
3 answers
249 views

Calculate next position and velocity after "bounce"

Intro and code I have the following function that calculates an object's "next" position and velocity (in 1 dimension) given a boundary [0, max]. ...
geofflittle's user avatar
6 votes
1 answer
404 views

Handling collision on a turn-based 2D game

I have implemented a collision check algorithm that I have created for my game, and the algorithm uses recursion. Now it all works fine, and I thought to myself, what if there was a way to solve this ...
Ben Beri's user avatar
5 votes
1 answer
347 views

Collision detection method

I think everyone has some code they are embarrassed and not proud of and today I have decided to show mine. I'm not sure how to go about making this more efficient. At the time I was just happy it did ...
SJJ's user avatar
  • 51
4 votes
0 answers
151 views

Hash Based Data Structure in Java for Collision Calculation

I have started a project on my free time were I'm writing a 2D game engine in Java. One of the more challenging and interesting aspects of such a project is collision detection between sprites on the ...
mantono's user avatar
  • 161
11 votes
1 answer
359 views

Basketball Collisions with Box2d

I'm working on a new prototype that is a simple drag and shoot arcade basketball game. For this project I am working with LibGDX and the Box2d physics library. You can play the game here: Play ...
bazola's user avatar
  • 8,569
3 votes
1 answer
289 views

Checking a circle against some bounds in a collision detector

First, some code. I have a class, Circle: ...
Judgemental's user avatar
5 votes
2 answers
474 views

Obstacle-avoiding AI

I have made a game in Java that involves two players to fight each other with spaceships. For one player mode, I have programmed a simple AI to avoid allies and asteroids and go straight towards the ...
Blue's user avatar
  • 574
3 votes
6 answers
703 views

Conditionally eliminating one of two colliding bodies

I like to explicit return function even for void functions to reduce the use of if-elses, like this code snippet: ...
alexpfx's user avatar
  • 524
5 votes
1 answer
437 views

Platformer with collisions

Today I started to build my first platformer, first time working with collisions and stuff. Now, surprisingly, everything seems to work, but since this is my first time creating a platformer and I'm ...
The Coding Wombat's user avatar
2 votes
1 answer
74 views

Check for collision with side of screen

I thought of a program where you move a square with the arrow keys. I created it and asked a question about it on Stack Overflow. I copied the last code block of the accepted answer and tried to ...
The Coding Wombat's user avatar
7 votes
1 answer
944 views

Quad Tree and Collision Detection Implementation

I have an implementation of a quad tree and abstract collision detection classes. The code works but looks very ugly, but I don't know what I could change to make it better. The reason I used two ...
T_01's user avatar
  • 173

15 30 50 per page