Questions tagged [2d]

2D computer graphics is the computer-based generation of digital images—mostly from two-dimensional models.

Flat perspective, having no three-dimensional geometry. Including two-dimensional space and 2D geometric models, or two-dimensional images having only height, and width with no depth.

7489 questions
15
votes
4 answers

What is the "side scrolling hack" from old games?

I have heard that old arcade side scrolling games used a specific programming hack to enable performant side scrolling. I understand that years ago the machines weren't powerful enough to repaint the whole screen every frame as it's done nowadays.…
Kos
  • 70,399
  • 25
  • 169
  • 233
15
votes
6 answers

Python: One-liner to perform an operation upon elements in a 2d array (list of lists)?

I have a list of lists, each containing a different number of strings. I'd like to (efficiently) convert these all to ints, but am feeling kind of dense, since I can't get it to work out for the life of me. I've been trying: newVals = [int(x)…
aped
  • 193
  • 1
  • 1
  • 8
15
votes
4 answers

Moving a Point Along a Line in JavaScript Canvas

Let's say that I have the coordinates of a line (25,35 45,65, 30,85 - It would be a two part line). I need to move a point (car) along that line at a constant distance every frame. How can I do this?
Conner Ruhl
  • 1,693
  • 4
  • 20
  • 31
15
votes
2 answers

how to calculate all pairwise distances in two dimensions

Say I have data concerning the position of animals on a 2d plane (as determined by video monitoring from a camera directly overhead). For example a matrix with 15 rows (1 for each animal) and 2 columns (x position and y…
distance deprived
  • 151
  • 1
  • 1
  • 3
15
votes
1 answer

Skia vs Cairo vs Direct2D, which is the most feature rich?

A just curious question. I'm aware that: Skia, Cairo: library Direct2D: API But without any additional components, exclusively on Windows platform, which bears the most features? I'm not talking about performance or programming simplicity. Is…
Abrar Borno
  • 373
  • 1
  • 3
  • 10
15
votes
3 answers

Convert Spritekit Game to Android?

Are there any new options for converting a spritekit game to android? It seems the only options are to recode everything in Java or to use Cocos2D, LibGDX, etc.
user6025921
  • 165
  • 1
  • 5
15
votes
3 answers

How to pass 2-D vector to a function in C++?

If it is passed, is it passed by value or by reference? void printMatrix(vector> *matrix); ... vector> matrix(3, vector(3,0)); printMatrix(&matrix1);
bsoundra
  • 930
  • 2
  • 13
  • 27
15
votes
2 answers

2D orbital physics

I'm working on a 2D physics engine for a game. I have gravity and masses working, using a simple iterative approach (that I know I'll have to upgrade eventually); I can push the masses around manually and watch them move and it all works as I'd…
David Given
  • 13,277
  • 9
  • 76
  • 123
15
votes
6 answers

Finding all points in certain radius of another point

I am making a simple game and stumbled upon this problem. Assume several points in 2D space. What I want is to make points close to each other interact in some way. Let me throw a picture here for better understanding of the problem: Now, the…
Saraph
  • 992
  • 1
  • 11
  • 25
15
votes
5 answers

Flipping a 2D Sprite Animation in Unity 2D

I've got a quick question regarding 2D Sprite animations that I haven't been able to find specifically answered anywhere: I have a sprite with walk animations to the right. However, I obviously want to flip the animation to the left when he walks…
Jestus
  • 623
  • 2
  • 9
  • 25
15
votes
7 answers

Is there a 2d sprite library for webgl?

I am looking to build a 2d game using WebGL. I want the hardware acceleration that WebGL provides and I cannot get this from the 2D canvas context in the canvas tag. With that said, is there a tutorial on creating 2D sprites using webGL? Or,…
Devon
  • 5,786
  • 5
  • 38
  • 46
15
votes
2 answers

XNA 2D vector angles - what's the correct way to calculate?

what is in XNA in 2D the standard way vector angles work ? 0 degrees points right, 90 points up, 180 left, 270 down ? What are the 'standard' implementations of float VectortoAngle(Vector2 vec) and Vector2 AngleToVector(float angle) so that…
Led
  • 2,002
  • 4
  • 23
  • 31
15
votes
10 answers

Is there any algorithm for converting 2D video into 3D video?

Is there any algorithm for converting 2D video into 3D video (for viewing using glasses)? (A-la turning Avatar into Avatar for an IMAX 3D experience.) Or at least turn it into video prepared for feeling some 3D viewing using it a-la: (source:…
Rella
  • 65,003
  • 109
  • 363
  • 636
15
votes
3 answers

What's a good, simple, 2D rectangles-only collision detection algorithm?

I'm designing a collision detection game tutorial for young adults, so I want this to be as simple as possible to make it easier to explain. The requirements are very simple. The world is 2D and contains only rectangles (of arbitrary sizes). BSP and…
Alvin Smith
  • 151
  • 1
  • 4
14
votes
1 answer

Merge 2d line segments

I am looking for a way to join together 2D line segments. A line segment is made of up two vector points, the start of the line segment and the end point of the line segment. I want to join line segments that look like they should form the same…
Jkh2
  • 1,010
  • 1
  • 13
  • 25