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
18 views

Can't play animation from script in unity

I'm making a 2D sidescrolling game in Unity, and when the player shoots an obstacle, I want the obstacle animation to play and then destroy itself. I got it to destroy itself, but the animation won't ...
1
vote
1answer
14 views

Anchoring HingeJoint2D to clicked upon spot

I'm creating a 2D game where the user can click and drag objects around. This is done by connecting a 'Hand' object to the object the user is current clicking on with a HingeJoint2D. Right now it ...
0
votes
1answer
50 views

2D Tile Movement in Java

I have this tilemap and a player in my game, and I got the player to move by adding the velocity to the position. However, it is very hard to control the player exact this way of the tilemap. So, I ...
-1
votes
1answer
19 views

Unity 2D collision detector not working

I'm making a 2D sidescrolling game in Unity where the player shoots at obstacles while running. But nothing I try seems to get the collision detection to work. This is the obstacle script: void ...
0
votes
1answer
22 views

How do I make this block go back to the left with another click?

This is the script I've written so far which makes the block move from the left of the screen to the right on a mouse click. What I want to achieve is for the block to move back to the left when I ...
0
votes
1answer
16 views

My Collider2D checkerscript not working [on hold]

So today I started working on my little android game but I ran into a problem whit my moving script. Whenever I jump I will be able to jump more than once.I have attached the script to the player and ...
0
votes
0answers
27 views

Slick2d - Why is my init() method running twice?

In the init() method, I have called the method loadMap() from the "world" object. But it seems to be called twice. I do not want loadMap() to be called twice. I have no idea why is this happening. ...
0
votes
1answer
19 views

Out of screen position to inner screen position

I don't know how I could solve this. I'm trying to accomplish this: So if a object is out of my screen I would like to calculate the position it would be inside of the screen. Searched already but ...
0
votes
2answers
61 views

Should I use DirectX 11 for 2d games or should I stick to DirectX 9? [on hold]

After two years now I wanted to continue working on my sandbox project which I actually used to learn and experiment with various C++ features and DirectX. So far I have simple elements for 2d ...
0
votes
1answer
14 views

Changing one prefab changes all other instances of that prefab too

I have made two prefabs of my enemies for my 2D game: normal and damaged. The I put several of these prefabs on scene. When enemies health <=0 I need to destroy its GameObject and then instantiate ...
0
votes
0answers
34 views

2D AABB vs AABB side of collision and collision depth

I realize there have been a multitude of questions involving 2D AABB vs AABB collision, but the questions and responses always avoid the simple questions that make it difficult. To keep things ...
6
votes
1answer
765 views

How do you handle 'move to mouse', if the player is already at the mouse?

I'm making a top-down-2D game. When my player moves, the cursor does not move with it. In my game, the player moves by facing the cursor and then walking toward it. This means that eventually, the ...
0
votes
0answers
19 views

Placing tiles on 2D Simplex noise [duplicate]

I have been experimenting with 2D Simplex noise for a mini-project and while I cannot say I understand the maths behind it, I begin to feel quite confident with how I can manipulate it to get ...
0
votes
1answer
48 views

Handle Entities & Collision in large numbers [closed]

I am creating a simple 2D maze game and I am a little confused about entities & collision detection. At the moment, my entity class is an abstract class containing position, velocity, sprite and ...
0
votes
0answers
20 views

How can I optimize my XONIX game flood-fill algorithm? [closed]

I am implementing a XONIX game, using FLOOD FILL algorithm, but I want to optimize it to improve performance. How can I do that? (I am willing to use a completely different algorithm, if possible) ...
0
votes
0answers
30 views

Pygame: Right Datastructure for 2D Games [closed]

Development-Community, i started to program with pygame and stuck at the question what's a right datastructure for 2D games like Diablo/Warcraft (of course with inferior graphics). My main Problem is ...
0
votes
0answers
27 views

Scaling character sprite based on angle of camera in 2d scene [closed]

I have a complex 2d scene that has been drawn roughly as if the camera is tilted at 60 degrees. I want to scale my character sprite in the scene as the character goes into the distance (i.e up the y ...
2
votes
3answers
84 views

Hero made of parts 2d rotation

I have a problem with rotation of my hero in 2D space. The hero is made of body parts such as: head, arms etc. Every part is a separate sprite. When I want to rotate the hero, I have to rotate all ...
0
votes
1answer
29 views

Rotating and scaling textures built up of pixel arrays in java?

I'm making my first real game, in Java, and I'm currently working on the base system, for rendering images (sprites) and I wonder how I can rotate sprites. My sprite class looks like this: ...
0
votes
0answers
41 views

Unity 2d Side Scrolling Mobile Prefab Problem [closed]

hi im trying to use the 2d side scrolling prefab that comes with the standard mobile assets. When i drag it onto my heiarchy its default position is set and i can see the touchpads. But when i play ...
5
votes
2answers
455 views

2D games and modern OpenGL

Preconcepts Ok, so what I've gathered so far is this: don't use fixed pipeline (deprecated or going to be deprecated) vbos store "object models" (n vertex data, mostly) vaos describe how data is ...
1
vote
2answers
103 views

How can I highlight and move to adjacent tiles in an isometric grid?

I trying to create a turn-based strategy game where you move a game object from one tile of a grid to another tile near it. I have created the grid using sprites and game objects but can't sort out ...
2
votes
1answer
63 views

2D collision of thrown objects in Unity

I am currently working on a game inspired by traditional 2D Zelda games ("Link To The Past", etc.) in Unity using the 2D settings. I am looking for the best way to handle objects that the character ...
0
votes
0answers
24 views

rotate to movement direction [duplicate]

If I have a player character that can move 8-directionally, I can set the rotation of the player to face the direction of movement. But if I want to smoothly rotate to a direction, sometimes the ...
0
votes
2answers
52 views

How to draw a textured 2D square using OpenGL

I am attempting to get started using OpenGL, and have learned how to open a window and draw basic shapes. However, I do not know how to texture them and have been unable to find any tutorials on how ...
3
votes
1answer
72 views

Sending Client Input to Server (which way?)

I am trying to get networking working for my game, I've read several sources of information about this subject but one thing is still unclear for me. The way I process client input is by executing a ...
0
votes
2answers
110 views

How to show my XNA game in form C#

I have a game in XNA, I want to connect this game with WindowForm to show for example the distance and the position. I tried to apply many tutorials that talking about this. but here is my problem : ...
1
vote
2answers
53 views

Collision between Mesh Plane and 2D Sprite

I've just recently started programming using Unity and made a couple of games with it, I'm trying out more and more advanced stuff as I do more games, but right now... I'm trying to make a game ...
1
vote
1answer
52 views

Simplified aerodynamics for 2d (top-down) airplane

I am writing a top-down 2d game, in which the player can control an airplane via the WASD keys. The W key should move the plane upwards (north), the A key to the west, and so on. Now I need a ...
4
votes
2answers
150 views

Isometric graphics with fake perspective

Diablo 2 is a game with isometric graphics. However, unlike other isometric games, D2 has the option to activate perspective. Obviously, the D2 developers found a clever trick to convincingly fake ...
0
votes
1answer
49 views

Dealing with multiple 2d sprite animations for the same object

I am using libGDX for a 2d game. Some of my in-game objects have animations, for example a soldier in top-down view that has a walking animation. That is working fine. Now, while walking, this ...
-1
votes
1answer
57 views

Yeild waitForSeconds(5.0) is not working

I am trying to call another function continuously from my Update() function. So, I have used yield WaitForSeconds(5.0); but, the it stops for the first 5 seconds and it does not stop the next time it ...
0
votes
1answer
55 views

Why does this code not update my object's position?

I am trying to move the object in my frame in Time.deltaTime. I have not taken care the speed yet but the problem is, the object is almost at position (0,0) after I have multiplied the x & y axis ...
0
votes
2answers
65 views

What is the best practice for handling touch events on different GameObjects in Unity2D?

First of all I want to describe what I have in my scene. 1. Joystick. 2. Main character that has link to joystick and handles touch events from joystick. 2. Buttons. 3. Other GameObjects that must ...
0
votes
2answers
84 views

32 bit or 16 bit textures

I'm trying to build some 2d character with Photoshop and Spine. By now, I have created some of my characters using 16 bit color depth images in Photoshop. Now, I wonder whether I have to use 32 bit or ...
1
vote
0answers
35 views

Setting the main camera's size to be equivalent to the device's width and height

Making a 2D game with Unity. I need a way to set the main camera's width and height to be equal to the mobile device's resolution. So if you're using an iPad Mini 3, then the main camera will be 2048 ...
0
votes
2answers
99 views

How to reverse gravity in Unity

I'm trying to figure out how script gravity reversal on collision with an object. How can I reverse gravity?
1
vote
1answer
45 views

How do you save Path2D data?

I am making a java game using path geometry. Is there any way to save the data stored in a Path2D to a file?
0
votes
1answer
66 views

Best way to go about collision between rectangle and bool array containing pixel data?

Basically, if I have an array along the lines of bool[] collision; Filled with a value for each pixel in the sprite I am checking collision against (pixel 1 = true, pixel 2 = false etc), how do ...
1
vote
1answer
191 views

How to keep player in the center of the screen but let him move to the edge of the map without moving camera there? [duplicate]

In my rpg-styled (top-down perspective) 2d game, I want my player to be at the center of the screen, while the entire world moves, giving the effect of player movement. I can make that, but my problem ...
0
votes
1answer
25 views

Destroy a single list member

im trying to destroy a single game object using the following script but it destroys all of them , not the ones I want. I want to destroy the ones that the transform that holds this script collides ...
0
votes
1answer
41 views

How do I split a button graphic into a 9 patch?

I understand what a nine patch is but I don't understand how to create one with code. I've made an image with a 1-pixel black border, but how do I turn that into a nine patch? How do I make a nine ...
0
votes
1answer
67 views

Java 2d Gaming, best practice to update random falling objects

I'm new to game development. I do have basic knowledge in Java and also have moderately good experience in OOP from other languages. I started developing this simple 2D game as my first project. The ...
1
vote
1answer
34 views

Positioning of AABB / Rectangles

I am wondering what is the best way to position rectangles, the ways I have thought of are: Have an x and y at upper left, then have a width and height Have an x and y at upper left, and an x and y ...
0
votes
1answer
57 views

Bounding Box not rotating based on draw rotation (Java)

In the process of developing a 2D game and am having some issues with translating coordinates on rotation. The object being rotated is a sword that is attached to the player. The player currently ...
1
vote
1answer
66 views

Getting normal map of an image

I'm trying to achieve the results in this tutorial: Link So far, I was be able to do that; with these; public PixelMap GetNormalMap(double strength) { var newMap = new ...
3
votes
2answers
110 views

Bevel outline algorithm in 2D

I'm writing a program that creates animated blobs in 2D, to simulate cells. In order to beautify these objects, I'd like to give them a 3D look by adding a bevel-effect. How can this be achieved? ...
1
vote
2answers
108 views

How can I handle position in an entity system where position can be 2D or 3D?

I'm working on a game engine to learn how it's done (so I might better take advantage of the techniques involved and other, similar engines in the future), and I've run into a problem when handling ...
0
votes
1answer
38 views

Why is 2D light ray collision result getting inverted at specyfic angle

recently i've been working on 2D lighting for my game. I've created new little project, and I've encoutered a problem. The collision between light ray and the object is fine at angles 316-360 and ...
0
votes
2answers
152 views

Can the GUI be used to create game objects?

I want to be able to position 10 various game objects (sprites) within the area of the screen which will be dynamically sized accordingly to the screen size of the device. The area in which I want to ...