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

2
votes
2answers
155 views

2d platform game with zoom in and out

I am using AndEngine, and I wish to create a 2d platform game like worms, where I can zoom out to see the whole world and zoom into single character, so I can select it. I do not want to use the zoom ...
0
votes
1answer
78 views

Java Scrolling 2d Block game - Optimise my code?

I have a 2d game where you look down from above and can scroll up, down, left and right using a viewport and a much bigger map. I have been having trouble drawing a rectangle around the block under ...
4
votes
1answer
356 views

Algorithm for randomly generating reachable platforms

I want to randomly generate reachable platforms on the fly for a 2D game. Right now, I am just creating platforms at random x,y positions. Only 4 platforms can exist at once, so once the 5th one is ...
0
votes
0answers
49 views

Working with tiledata of different sizes [duplicate]

I recently bought an asset for my game, basically a tilesheet, with seperate pngs as well, but where as previously I've created tilemaps out of identically sized tiles these are all in varying sizes ...
17
votes
2answers
733 views

How do I make a character capable of walking on walls?

I am trying to get a character to move like a spider: Given a rising slope which a ball would normally not be able to roll up, the spider would slowly crawl up. Similarly, given a mid-air rectangular ...
1
vote
0answers
55 views

how to project a collision between a pair of polygons under rotation?

I am trying to create a physically plausible 2d physics engine. I have read many documents about detection of collisions, contact resolving, interpenetrations, projection, separating axis theorem ...
1
vote
2answers
173 views

2D open world MMORPG; big map memory problem [duplicate]

I am developing an 2d open world mmorpg game for learning purposes, and have a issue with big maps. A year ago i developed 2d open world single player / co-op game. It saved map in chunks, and AI for ...
0
votes
0answers
94 views

Improve interpolation in 2d multiplayer game

I have a problem to solve while prototyping networking for a 2d game. Here's what I have so far and what's giving a headache: I run a multi-player session where one host is an authoritative server ...
0
votes
1answer
218 views

Platformer raycast collision detection

I'm using Unity to create a 2D platformer. For collision detection, I'm using raycasting to detect any possible collisions with specific collision layers, and adjusting the desired delta x & y ...
1
vote
1answer
168 views

Each level is one scene?

I'm planning to get into Unity 2D tools - so in order to start off I decided to create a little breakout clone. However, I'm not sure how to manage levels. When I wrote Breakout using MonoGame, I just ...
0
votes
0answers
54 views

Efficient 2D Drawing Manager Pattern

Most 2D game development tutorials use frameworks that already have a drawing management system or simply the host computer running the game has so much power that the game runs fluently. Now ...
0
votes
1answer
34 views

Best method for selecting points from a point set - path distance

having a big set of points and a polygonal path what is the best way to select a set of points that are at a certain distance or smaller from the path? Or do I need to iterate thru all points on each ...
0
votes
1answer
64 views

How can I move the view in a DirectX game?

I'm making a game in C++ using Direct3D 9. How do I move the camera at constant rate? I'm making a Flappy Bird type game and I'd like to move the camera forward through the level.
12
votes
1answer
1k views

In platformer games, what are “hole in the ground” obstacles called?

In most jump and run games, holes in the ground are common obstacles: You need to jump over them, or you'll fall down and lose a life. It would be helpful to know for documentation, variable naming ...
0
votes
1answer
25 views

How can I load a picture with alpha channel in JME?

This code loads a picture into the game: Picture mypic= new Picture("mypic"); Texture2D tex = (Texture2D) assetManager.loadTexture("Textures/mypic.png"); ...
0
votes
0answers
30 views

Dealing with 2D tiled maps in DirectX

I'm new to DirectX. I'm pretty much to the point to where I can create some sprites and attach textures to them, but I'm not fully cognizant of the entire model of textures and sprites or exactly how ...
1
vote
3answers
268 views

Two sided sprites

What is the most efficient way of making two sided sprites in Unity's new 2D tools? I'm looking to make playing cards with a backside and a front side.
1
vote
0answers
86 views

How should matrix-based Parallax Scrolling work?

The question is at the end, as it requires a bit of context. I'm not sure if my understanding, my code, or LibGDX's ParallaxCamera is wrong. LibGDX's ParallaxCamera uses Matrix4s to achieve a ...
2
votes
1answer
86 views

XNA: Non-overlapping shadows

I want to create an effect similar to the following in XNA / MonoGame: There's a background and a semi-transparent shadow consisting of several objects (two circles in this example). However, the ...
3
votes
2answers
176 views

How can I create an array of GameObjects?

I need to add one 2d assest multiple times in my scene and I was wondering what is the best way to do this because adding each asset individually and setting there locations doesent seem like the best ...
0
votes
0answers
82 views

Polygon Collision Response

I'm working on a game engine that has a built in custom physics engine (I know it's a waste of time, but I have years to make this, so why not make it good?). Currently, with any number of polygons, ...
1
vote
1answer
151 views

How should I handle animation states in Mecanim?

I did a tutorial which associated an integer to each state and manually set transitions from one state to another based on that integer, but that seems really sloppy. Is there a more elegant way? I ...
0
votes
1answer
85 views

What would be the easiest way to keep objects at a constant point on a 2D map, even when off-screen?

Like in Starcraft, where your army units stay put even though your view is moving around the map. I have a static tiled map that I made using Mappy and I can display that fine, I just want my ...
2
votes
3answers
131 views

How do I implement Breakout's “multiball” powerup?

I'm just starting out and making a breakout clone as my first game. I'm implementing all kinds of powerups, but I'm stuck on multiball. The powerup adds additional bouncing balls to the game. So far, ...
1
vote
5answers
137 views

How to reduce a rectangle without problems?

I'm developing an asteroids' game and I'm needing to reduce the rectangle of the spacecraft because when I use the method intersect() of Rect class to detect a collision with an asteroid they are far. ...
0
votes
2answers
108 views

Finding the nearest object, considering obstacles

For the purposes of this question, we'll assume it involves a Janitor assigned to clean up trash in a building. Given that it is a building, it is safe to assume there are one or more rooms, walls, ...
2
votes
1answer
166 views

How do I make the screen shake when the player takes damage?

I am making a 2D game and I'd like a visual cue when the player gets hurt. Currently, I have a simple blinking red dot that shows up for 2 seconds after damage, but it's not very immersive. Many ...
2
votes
2answers
153 views

Expandable 2d environment by spawning and controlling individual tiles

what is the best way to implement an environment that is "expandable" in every direction so that when the player moves in any direction a new row or column of tiles that can be manipulated ...
1
vote
2answers
113 views

Technique for multiple shadow casting lights in 2D

I'm trying to create shadows in a 2D game in such a way that I can have an arbitrary number of lights in a scene, all of which can cast shadows. To do this I think I have to generate a mesh for each ...
3
votes
4answers
117 views

Calculate turn rate between xy and target xy on a moving sprite with variable speed

My First question on here so be kind... I am writing an aerodrome simulator in as2, I need to calculate a turn rate between 2 points so that the aircraft turns nicely. I have tried a few things but ...
6
votes
1answer
177 views

Square Grid Polygonal Terrain Query algorithm?

I have a square, fixed-grid terrain with one terrain type per grid unit in my game, and I want to do an arbitrary polygonal terrain query which returns all of the grid units enclosed/intersected by ...
0
votes
0answers
50 views

LWJGL Rotating is moving

I am trying to rotate my QUAD even just a little bit. I have read pages like http://www.java-gaming.org/topics/lwjgl-tutorial-series-moving-and-rotating-triangle/30679/view.html In my render() ...
1
vote
1answer
43 views

Why does my camera break mouse position targeting? [duplicate]

I made a short video of this. Basically, when the screen scrolls with the camera, the character begins firing at the incorrect mouse position. You can see where I am clicking the whole time. As we ...
-1
votes
1answer
61 views

How do I detect how much of an object has been “cleaned” by the player?

I want to let the player wipe some dust off of a book, then start a short animation. Here's what it looks like: I'm using a clipping region on the "dusty" book bitmap image to progressively hide ...
0
votes
1answer
93 views

What are the correct angles in the Top-down perspective?

In the following picture it says that in the Top-down perspective the angles are 90°, but if it would be 90° then you shouldn't see the front of the building and the roof at the same time... So what ...
1
vote
1answer
39 views

Vertexquads are not being drawn in 2D space

I started teaching myself DirectX a short time ago and have come across a problem which I can't figure out by myself unfortunately. I'm trying to build my own font system, so I can draw strings in 2D ...
1
vote
1answer
70 views

Why does rendering a gradiented shape leave gaps?

Sometimes when I am drawing objects that aren't 'linear' (e.g. rounded edges, circles, ellipses, diagonal lines, etc) I this weird effect of some pixels at certain points not getting drawn. It's ...
0
votes
1answer
435 views

Switch character to play animation() in Unity3D using c# [closed]

I have two or more 2D character (Character A, B, n..). I made an animation on the character using the Animator class "AnimCharacter.cs". if i press the 'PgUp' character 'A' can call the function ...
1
vote
4answers
158 views

Get GameObject to bounce of colliders [duplicate]

I am making a Atari Breakout game with unitys 2d tools and I need to get the ball to bounce of colliders in the scene. If you havent played the game before how it works is if the ball hits the wall at ...
1
vote
1answer
97 views

Unity seperation of prefabs with two dimensional terrain generation

I have the following function: public void Spawn () { GameObject g = ((GameObject)Instantiate (hills [Random.Range (0, hills.Length)], new Vector3 (0.0f, ...
0
votes
0answers
54 views

Shadow wall sight problems

i used this tutorial https://github.com/mattdesl/lwjgl-basics/wiki/2D-Pixel-Perfect-Shadows to make my shadows. I think its a pretty nice and easy method. I render all my shadow in a Framebuffer and ...
1
vote
2answers
189 views

Should game objects draw themselves? [duplicate]

Assuming you have classes like Player, Enemy, Map and Tile. The first approach to structuring rendering code would be to give each a render() method and let it draw itself: void render(){ ...
3
votes
1answer
290 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 ...
-2
votes
2answers
92 views

What kind of calculations do I have to make for projectiles? [closed]

I could never find out, how to create projectiles in a 2D game. Does it need linear algebra? If not, what to do to calculate its path? I just simply want to create a projectile that follows a ...
0
votes
1answer
75 views

Grid collision - finding the location of an entity in each box

I am trying to implement grid-based collision in a 2d game with moving circles. The canvas is 400x400 pixels. Below you can see the code for my Grid class. What I want it to do is check inside which ...
-2
votes
2answers
67 views

How to calculate a bounding rectangle of a polygon?

Polygon poly = new Polygon(); poly.getPoints().setAll(5d, 15d, 15d, 25d, 5d, 30d); How do I calculate the Polygon's height and width? There is no poly.getWidth() or poly.getHeight() method in ...
1
vote
2answers
89 views

Calculate shadow map to overlay hidden line-of-sight things in 2d?

Given a 2D sideview with even-sized grid squares and our hero in a known center-ish position like this ... and imagining this hero's line of sight like this... how could one get the point values ...
1
vote
1answer
146 views

Strange collision behaviour in 2D game even though the collision is very basic [closed]

I have a player ship (cube) and some enemy laser projectiles. When the player ship has position X values greater than 1, collision with the enemy projectiles occur but when it has lower X values, the ...
8
votes
3answers
447 views

Can I jump from A to B?

I'm making some rudimentary AI for my side-scroller and I need to know whether an AI unit can reach point B from point A simply by taking a jump. Flight trajectory of my characters is a bit unusal as ...
-2
votes
1answer
50 views

What do the 6 points stand for in Polygon().getPoints().setAll?

I have the following code to create a polygon: Polygon poly = new Polygon(); poly.getPoints().setAll(14d, 17d, 26d, 17d, 20d, 27d); // What do these mean? What do these 6 points stand for?