Tagged Questions

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

0
votes
1answer
160 views

Incorrect sprite rotation with atan2() [duplicate]

I want to rotate a sprite so that it faces the mouse cursor/screen touch location. Currently I'm using the following method to compute the angle of rotation. The input position is the target point the ...
0
votes
0answers
658 views

Unity 2D - SpotLight and Shadow

I've been having some trouble in the process of creating my 2D game. Here is the thing, i want to create a light source on the top of the screen, blocked by some rocks and letting only go through some ...
1
vote
1answer
6k views

Change the sprite of a Object in Unity

Inside the script code of the the hero(object) I want add the possibility to change its sprite. So the player hits the space button and the sprite changes into the other sprite already added to the ...
6
votes
3answers
273 views

How can I calculate “All squares within R” in a natural looking manner?

I'm working with a square grid, and I have a couple of effects that target all squares within R; in other words, a circular (or spherical) effect. But, circles being, well, circular, and squares ...
1
vote
0answers
89 views

How do I load real-world map terrain? [duplicate]

I'm new to game development and want know how to make or load a terrain from OpenStreetMap or Google Maps in your current city. (I'm using Unity3D.) My idea is just load or generate a map of the ...
2
votes
2answers
89 views

How can I test if a point is behind a polygon in 2D?

In order to improve the performance of my visibility graph generator I am trying to figure out the following. Given the image below; is there a way to find out if a point is 'behind' the polygon? For ...
0
votes
1answer
135 views

Tile System with moving Platforms

I am using a tile based system where the level is stored in a char: char[,] Level2 = {{'.','.','.','.','.','.','.','.','.','.','.','.','.','.','.','.'}, ...
0
votes
1answer
47 views

Stopping sprties from toppling off platform

I am new to Unity and am trying to create a simple 2d platformer. I have applied a box collider to my player sprite and the floor/platform its standing on. Now when I go over the platform, it toppes ...
1
vote
2answers
4k views

Unity 2d: How stop movement when object hit a wall

I created a square that slides on a flat ground. public class PlayerMoveScript : MonoBehaviour { float move = 0; void Start (){} void FixedUpdate () { if (move == 0) { ...
0
votes
0answers
115 views

How to design basic physics and movement behavior for 2D platformer?

I want to make a simple 2D platformer. I know some basic 2D physics and how to implement them in a game. How to make a character jump, accelerate, decelerate, etc. But I have no idea how to actually ...
1
vote
1answer
306 views

Java : 2D Sidescroller Terrain [closed]

Okay so After all this Edits here is the main question. How I can generate Terrain with a 2d Simplex Noise Algorithm, I am deletng old info so the post its more readble. I´ve been doing some tests and ...
0
votes
2answers
348 views

2D Rectangle Collision

I want to make a small 2D game. In the game you can go in all directions(with the bird's-eye view) and can shoot. (A little bit like BoxHead http://de.y8.com/games/box_head_2play) My problem there is ...
3
votes
1answer
80 views

Field of view determination with partially opaque cells

I'm currently implementing the field of view of a player in a 2D-grid based game. I've chosen a standard ray tracing algorithm because he really fits the features needed in my game. However, the ...
1
vote
2answers
255 views

How to reduce/remove graphical artifacts?

Question I'm working on a side-scrolling game that has a 2D grid for rendering to the screen. I'm using OpenGL, and I've optimized my game so that nothing invisible is attempted to be drawn. As of ...
1
vote
1answer
86 views

How to apply steering to a physics body correctly when using a physics engine?

I have a top down 2d game that uses a physics engine (Farseer). I'm using the standard steering behaviors to make the AI move around but I'm not sure the correct way to take the so called "steering ...
1
vote
1answer
274 views

How can I simulate shadows for a 2D top-down game? [duplicate]

I'm trying to simulate shadows for a 2D top-down RPG (in Python), but I can't think of the best way to do this So far I've tried making copies of the original game entities and turning all opaque ...
3
votes
3answers
218 views

Using uniform grids for collision detection - Efficient way to keep track of what a cell contains

I was looking for an efficient way to implement collision detection in a 2D game. A way that won't result in an O(n^2) level of complexity. A lot of people recommend to use Uniform Grids for this ...
0
votes
1answer
124 views

2D animation is not rendered as it supposed to

I'm working with Melonjs, i have configured everything to update the character movement and still get this "delayed" rendering of the character. below is the constructor // call the constructor ...
0
votes
1answer
639 views

Unity - Light and sprite collision

I'm a beginner in Unity and i'm facing a little problem / question. The main purpose of my 2D game is based on the mouvment of a specific light and the player have to avoid getting inside his rays. My ...
1
vote
0answers
774 views

Unity 2D loading Spritesheet Atlas at runtime from web and using it dynamically

I am new to Unity (came from AS3/Starling) and just started for 2D games in Unity. I have a spritesheet / texture-atlas (many different sized images packed in a single png) which I want to download at ...
0
votes
1answer
164 views

Measuring distances on 2D perspective beat'em'up

I'm making a 2-D beat'em up. The tech demo is here. As you can see, the game is in perspective, pretty much like all old school brawlers. What I want to do is measure the distance between objects on ...
0
votes
1answer
268 views

Java 2D World: Convert from mouse screen co-ords to screen co-ordinates?

I have a 2D world background made up of a Grid of graphics, which I display on screen with a viewport (800x600) and it all works. My question is I have the following code to convert the mouse ...
0
votes
0answers
73 views

how to do picking in 2d lwjgl

I searched the whole internet, but I couldn't find something useful. How to do picking (like ray picking) in lwjgl in orthographic mode (2d)? I think this is less confusing than picking in 3d, but I ...
0
votes
1answer
696 views

Skeletal animation with Unity2D?

I want my character to aim with the mouse so, arms and head must move following mouse cursor and when the character is stand still it could change its stance a bit to accommodate the arms position. I ...
2
votes
2answers
214 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
137 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
537 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
51 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 ...
21
votes
2answers
2k 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
2answers
408 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
147 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
1k 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
338 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
66 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
45 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
187 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
52 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
80 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 ...
4
votes
3answers
949 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
169 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
2answers
154 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
759 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
144 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
1k 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
141 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
188 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
156 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
122 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, ...
3
votes
1answer
269 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 ...