Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 77195

2D refers to two dimensional space where coordinates are represented with X and Y values.

1 vote
Accepted

How to compute a normal in circle vs rectangle collision to push them apart?

Assuming the rectangle is axis-aligned (not rotated) I believe the simplest solution is to calculate the point on the rectangle that is closest to the center of the circle, then derive the normal from …
Charanor's user avatar
  • 8,203
1 vote

Java - Collision detection (Glitch)

I actually had the same problems many years ago when implementing collision detection in Java for my final year project (what a coincidence!). What I did to solve it was to inset the collision boxes b …
Charanor's user avatar
  • 8,203
2 votes

Unity 2d - Vector3.Lerp Not Working as Expected

This is because you are only calling Vector3.Lerp or MoveTowards while pos.x < 0.1 || pos.x > 0.9. This means that once the camera moves a little bit pos.x < 0.1 || pos.x > 0.9 won't be true anymore s …
Charanor's user avatar
  • 8,203
38 votes

How can I make user-friendly polar coordinate movement around a circle?

My first suggestion would be to just stick with A = Counter-clockwise and D = Clockwise movement. It is not very confusing and is pretty much the "standard" (i.e. most common) choice when it comes to …
Charanor's user avatar
  • 8,203
26 votes
Accepted

How can I implement persistent state for objects defined in a level?

Here's a pseudo-code example based on what I use for my simple 2D game: def load_map(map): for y in range(0, height): for x in range(0, width): tile = map[x, y] for …
Charanor's user avatar
  • 8,203
1 vote
Accepted

LibGDX player movment

You can set linear velocity when you release the movement key. It's as simple as doing body.setLinearVelocity(x, y) then just set the appropriate axis to 0. Example: if (Gdx.input.isKeyPressed(Keys. …
Charanor's user avatar
  • 8,203
1 vote

A single libgdx gamescreen with pop-up menu, getting ready, hud and game over?

You should probably take a look at Scene2D's Window class. Think of it as a screen that just overlays other screens. It's also a Table, which means you can add buttons or any other Actor to it just li …
Charanor's user avatar
  • 8,203
0 votes

How to apply friction vector to acceleration in top-down 2D game?

It looks like you're using acceleration in a weird way in your engine, so I can't give you a 100% fool-proof answer you can directly implement into your code, but I can take a shot at it. You'd want …
Charanor's user avatar
  • 8,203