2D games are drawn in a two-dimensional space using two-dimensional objects. To represent its position, each game object will have an `x` and a `y` coordinate.

learn more… | top users | synonyms

10
votes
1answer
2k views

Angle of Reflection

I have this "Breakeout style" game. I have a cannon at the center, blocks around the cannon and pads around the blocks. This is how the game looks like: I've managed to get the collision per ...
4
votes
3answers
7k views

2D Tile-based Collision Detection

I've been planning an indie game project for a while now. I'll summarise it for you so I can get right to the question. It's done entirely using the latest version of XNA through Visual Studio. ...
4
votes
2answers
3k views

How to calculate shot angle and velocity to hit a moving target?

I am developing a 2D Android game and I am making an aiming algorithm for AI projectiles to hit enemies either following a path, or free moving. At the moment it just calculates where the target will ...
6
votes
1answer
2k views

Sidescroller variable terrain heightmap for walking/collision

I've been fooling around with moving on sloped tiles in XNA and it is semi-working but not completely satisfactory. I also have been thinking that having sets of predetermined slopes might not give me ...
4
votes
1answer
532 views

Collision Detection with SAT: False Collision for Diagonal Movement Towards Vertical Tile-Walls?

I'm developing my first tile-based 2D-game with Javascript. To learn the basics, I decided to write my own "game engine". I have successfully implemented collision detection using the separating axis ...
2
votes
2answers
4k views

Arc'd jumping method?

Okay, so I'm making a platformer, and I wanna know how I can make a arc'd jump easily. Like what Mario does in super Mario Bros 1. Any ideas on a simple way to accomplish this?
0
votes
3answers
4k views

Where and how to obtain/buy good-looking 2D art sets [duplicate]

Possible Duplicate: Where can I find free sprites and images? I have developed a 2D engine which has a real lot of technology stuffed into it, but as I'm a programmer and a bad artist, I ...
6
votes
2answers
515 views

How do I keep my character centred on screen?

I am making a game similar to Legend of Zelda: Link to the Past (top-down 2D action-adventure). I want the character to stay centred on the screen when he moves. Currently, whenever the player wants ...
6
votes
2answers
2k views

How to store 2D tile-map

I want to create a 2D map composed of small tiles, that should look like voxels (eg. this just from side). I think I can make a structure like Voxel2D, that have int X, Y and some Color, and every ...
4
votes
1answer
1k views

Friction in 2D game

I'm developing a 2D platformer, although this question could probably apply to just about any 2D type physics; What is the equation for friction? I have sort of a hacky type of friction set up in my ...
3
votes
2answers
1k views

Can you help me find resources for developing a top-down 2D game in Java?

I just started reading about games, and I'm going to develop a game where a person is moving around on a 2D map. My preferred language is Java. Is that suitable to develop games? I'm going to ...
2
votes
4answers
3k views

Scrolling background loop

I'm trying to scroll my background forever and so I'm using the background image twice. When the first one goes off screen, it should relocate to the end of the second one. However, there seems to be ...
10
votes
0answers
906 views

How to create 2D shadows [duplicate]

I'd like to create lights and shadows in a 2D environment, like in the image below: I did several searches but got no results. Do you have any hint?
4
votes
5answers
622 views

How to randomly place rectangle inside a larger bounding rectangle without intersecting other rectangles inside

Let us consider the case: there is an overall bounding rectangle (call this Rb) which contains a number of rectangles within it (call this set SRo). Now I would like to randomly position a new ...
3
votes
1answer
411 views

How do I make a 2D character aim their gun toward the mouse?

Heli Attack is a perfect example of the shooting mechanic I'd like. The character aims perpetually toward the mouse. What's going on here? From what I've read so far, you could separate the arm and ...
3
votes
3answers
4k views

Triangle - Rectangle Intersection in 2D

I had previously asked this for 3D but now I changed my strategy and would like to do the intersection in 2D. The Rectangle is axis aligned and will always be in a fixed position, and has a constant ...
49
votes
5answers
6k views

What to consider when deciding on 2D vs 3D for a game?

How much "harder" is 3D than 2D in terms of: Amount/complexity of the code Level of math skills required Time involved in making art assets Original title: How hard is 3D game development versus ...
32
votes
4answers
7k views

How to render 2D particles as fluid?

Suppose you have a nice way to move your 2D particles in order to simulate a fluid (like water). Any ideas on how to render it? This is for a 2D game, where the perspective is from the side, like ...
30
votes
1answer
6k views

Rendering SVG art directly in XNA

Suppose I have a bunch of 2D art in some vectorized format such as SVG. Is there an easy-ish way to render that directly without having to implement a full SVG renderer myself? Of course I could ...
11
votes
2answers
12k views

Is there a good way to get pixel-perfect collision detection in XNA?

Is there a well-known way (or perhaps reusable bit of code) for pixel-perfect collision detection in XNA? I assume this would also use polygons (boxes/triangles/circles) for a first-pass, quick-test ...
14
votes
2answers
3k views

Creating an electricity/lighting/tesla coil effect in a 2D XNA game?

I'd like to create beams of electricity between two points very similar to this video: http://www.youtube.com/watch?v=eMJ8-56L3Lc. The effect is so dynamic, with varying lengths and pseudo-random ...
12
votes
4answers
14k views

Best Way to Create A Map for a 2D Game?

I apologize for the subjective "best" keyword. My friend and I have started creation of a 2D adventure game. It will be top-down in the style of pokemon or zelda (just the perspective). We have been ...
16
votes
1answer
2k views

Procedural Generation of Infinite Level

What are some good approaches to procedurally generating an infinite 2d level? The level could be constrained in either dimension but not necessarily. The approach that makes most sense to me so far ...
16
votes
3answers
2k views

How can I generate random lakes and rivers in my game?

I have a 2D block building game and am trying to make randomly generated lakes and rivers. I have looked into the Perlin noise algorithm, but, I couldn't get it to generate random and nice results. I ...
9
votes
4answers
926 views

What's the most efficient way to find the intersection point of a missile and a bitmap terrain?

Following up on my earlier question about finding the slope of a 2D bitmap terrain I now need to know the best way of finding the point on the 2D terrain that the missile hit. Obviously, I can see if ...
6
votes
5answers
1k views

(Where) Can I learn to create art for my 2D games?

I'm currently bad at drawing. If I want to create something looking acceptable, it usually takes me hours and hours to fiddle around just to get the basic looks right. I think that I'm not completely ...
21
votes
2answers
1k views

Mega Man-style screen scrolling design

The NES classic Mega Man series uses a very specific scrolling technique that I'm having a hard time wrapping my head around implementing. Essentially, the level is divided into "screens" which are ...
6
votes
2answers
4k views

C# Perlin noise - generating “endless” terrain chunks?

I'm currently writing a little side scroller in C#, to both learn C# and have fun. Right now I have a simple random number generator generating the world but it isn't exactly all that great - so with ...
12
votes
2answers
5k views

Are high powered 3D game engines better at 2D games than engines made for 2D

I'm a software engineer that's new to game programming so forgive me if this is a dumb question as I don't know that much about game engines. If I was building a 2D game am I better off going with an ...
10
votes
5answers
2k views

2D Game dev and Java. Other possibilities than OpenGL?

I recently startet to programm some basic OpenGL stuff in Java, but OpenGL and DirectX is to much to handle and to understand for me and i'm getting bored really fast. Now i am wondering if there are ...
7
votes
3answers
2k views

2D Top down view maps

I was wondering how this works. Do you load the complete map when the game starts up, or do you load parts of the map at runtime? And how would you save the maps? Would it be in XML or some binary ...
5
votes
1answer
2k views

Slopes in 2D Platformer

I'm dealing with Slopes in a 2D platformer game I'm developing in XNA Game Studio. I was really tired of trying without success, until I found this post: 45° Slopes in a Tile based 2D platformer, ...
5
votes
4answers
6k views

2D Platformer Collisions

I've basically asked this question before, and I know it's been asked probably a billion times, but I still can't seem to do it. All I want to know is how I should go about doing basic 4-way, ...
4
votes
1answer
1k views

The Physics behind 2D Platformer Games? [closed]

Is there any good book or tutorial that explains the physics behind creating a 2D Platformer game? Such as tile rendering, tile map reading, collision detection, camera movement etc.?
4
votes
4answers
19k views

Android game scrolling background

I'm just trying to figure out the best approach for running a scolling background on an android device. The method I have so far.... its pretty laggy. I use threads, which I believe is not the best ...
13
votes
2answers
1k views

How do you handle uneven tiles while rendering a tile map?

Here is what I want to do with my tile map that I am unsure of. As you can see the top walls are way larger then the bottom and side ones (this is also an issue with my corners which are odd shapes ...
7
votes
4answers
23k views

Free to use resources for 2d platformer Sprites [closed]

I've looked at a couple other questions about Sprites but most seem to apply to Isometric or RPG related sprites. So I'm wondering if there is a decent place for 2D side scrolling plat-former type ...
17
votes
4answers
3k views

How to deal with corner collisions in 2D?

I'm writing a top down 2d XNA game. Since its my first I'm trying to write the physics and collision stuff myself to learn it. Whenever my player sprite character attempts to move into a position ...
13
votes
1answer
2k views

How are “2.5D” art assets created?

By "2.5D" I mean the art style in games such as Roller Coaster Tycoon, Age of Empires 2 or Fallout 1 and 2: Everything in the games appears to be created with a "pixel art"-like tool. Am I correct? ...
4
votes
2answers
735 views

2D lighting theory: day-and-night cycle, spot lights at night

I am writing a rogue-like 'zombie' management game. The game map will be similar to Prison Architect. A top-down 50 X 50 grid. I want to implemented a day night cycle and during the night I would ...
4
votes
2answers
2k views

Viewport / Camera Calculation in 2D Game

we have a 2D game with some sprites and tiles and some kind of camera/viewport, that "moves" around the scene. so far so good, if we wouldn't had some special behaviour for your camera/viewport ...
4
votes
2answers
4k views

How to get mouse position relative to the map?

I'm creating a game in XNA similar to Minecraft - Minecraft 2D It looks like this Here's how it works: All blocks are generated once with fixed x,y coordinates and just re-drawn. //generate ...
2
votes
2answers
3k views

How to Create a Grid for a 2D Game?

So I'm currently writing the engine for my videogame. I've almost integrated Tiled (I think) so I should have a map-creator here soon. My question is, how do I actually make the grid? I'm really ...
15
votes
4answers
3k views

What are the pros/cons of using a 3d engine for 2d games?

What pros or cons should a beginner be aware of when deciding between a 2d game engine (like Slick2D/Flixel/FlashPunk) and a 3d engine (like Unity) for 2d game development? I am just getting started ...
8
votes
7answers
1k views

Can I use copyrighted sprites for a demo?

I just had a quick question and wanted everyone's opinions. I'm making a 2D demo game for a resume which I want to post online. I'm applying as a programmer position so I don't really have my own ...
8
votes
2answers
2k views

How to calculate the vector of an interception?

Given are a twodimensional space, and 1 friendly spaceship standing still, one foe is moving NOT directly to the friendly ship with known actual position, speed and direction. The friendly ship wants ...
8
votes
2answers
4k views

2D object-aligned bounding-box intersection test

I have two object-aligned bounding boxes (i.e. not axis aligned, they rotate with the object). I'd like to know if two object-aligned boxes overlap. (Edit: note - I'm using an axis-aligned bounding ...
5
votes
1answer
1k views

2D collision-detection middleware

(This question was split off from http://gamedev.stackexchange.com/questions/3345/) Are there any recommendable middleware available for 2D collision detection? I believe I've heard that Box2D could ...
-5
votes
1answer
747 views

How to properly scroll a 2D tilemap?

Hello and I'm trying to make my own game engine in Java. I have completed all the necessary ones but I can't figure it out with the TileGame class. It just can't scroll. Also there are no exceptions. ...
6
votes
2answers
2k views

Matrix for 2D perspective

I'm trying to determine whether what I'm attempting to achieve is even possible mathematically. I'm obviously not a seasoned game developer so I'm having trouble even coming up with the terminology to ...