Flat two-dimensional space. Positions represented with `x`, `y` coordinates.

learn more… | top users | synonyms

0
votes
1answer
102 views

Perspective Projection - Drawing Lines

So I sort of understand the math behind projecting 3d points onto a 2d plane. It's just some simple dividing and multiplication of distances. However I can't seem to wrap my head around projecting ...
2
votes
2answers
108 views

AndEngine rotate all connected bodies

I have created below hexagon structure in Andengine with box2D physics extension. I want to rotate whole structure with respect to center when other ball collides with the structure using physics. ...
0
votes
1answer
146 views

How do I calculate the bounce vector of a ball hitting the starting point of a segment?

I have a ball (with parameters x, y, radius) that travels on the screen (with vectors directionX directionY) and can collide with a segment with random slope (with parameters startX, startY, stopX, ...
0
votes
1answer
303 views

How can I map regions on a world map image?

I am trying to use a map of the real world, but I need to have a way to break it down by countries and regions. Ideally down to a province level. I figure that I'd need to be able to define ...
0
votes
1answer
87 views

Intersperse 2D with 3D opengl

I want to be able to draw 3D objects as well as 2D objects in an openGL environment. Normally, I would draw my 3D stuff, disable the depth buffer and depth mask, then draw my 2D stuff. However, this ...
0
votes
0answers
111 views

Configuring touch input for a mobile game?

I'm trying to configure my game to take touch input from buttons but my scripts don't seem to be working. Here is the script for receiving touch input: using UnityEngine; using System.Collections; ...
0
votes
2answers
170 views

How to make a gameobject Scale up from another GameObject script

hi there im having a rought time with this code, trying to make a gameobject grow in scale from touching this one, and when a set amount of scale is reached destroy this game object ( the one who ...
0
votes
2answers
109 views

Unity2D Best way to determine degrees between two colliding entities?

I'm trying to determine the collision-direction between two objects. I'll be using this for various things such as creating blood-entities in a specific direction proportional to where the other ...
0
votes
2answers
365 views

C# xna/monogame ghost trail effect

I would like some know how can someone make an animation like this, in Monogame specifically.Since i am completely clueless on how to go around this i how should i go about this ? I hate asking ...
0
votes
0answers
34 views

How to rewind time on just the main character? [duplicate]

I have a 2D sidescrolling game and I want the character to be able to rewind time on him if he messes up. I don't want anything else to change, just the main character's position. Any idea how I can ...
1
vote
0answers
156 views

Xna 2d texture antialiasing

I've got a problem with drawing 2D texture in xna 4.0. My program generates terrain texture: The problem is in rough surface of my texture (dark-blue) that is generated by-pixel. Is there any ...
0
votes
1answer
124 views

Port sandbox flash game to Android and iOS

I'm want port my sandbox game to Android and iOS. Game written in AS3 (i'm use my simple 2d engine on stage3d). What do you recommend I use? Haxe + OpenFL MonoGame + Xamarin (C#), or other 2D engine ...
1
vote
1answer
49 views

Why is the Hiero font not coordinated to fit neatly in the display window?

I imported a font with Hiero and I draw the font like: font.draw(batch, "1", 0, 48); This is the resultant image: So the font it moved up to hit the bottom perfectly, but it doesn't touch the ...
0
votes
1answer
115 views

Mesh Generation In Code [closed]

My camera looks like this: I am trying to add 2D polygons to the screen based on the percentage that they take up of a 1920x1080 pixel canvas. Therefore, I calculate this and then use ...
0
votes
2answers
259 views

Raycasting on Z in 2D

I'm making an isometric game in Unity. So far I have managed to render a diamond shaped board, with tiles that are aligned on the x and y axis (and the camera looks down the Z axis). I am spawning ...
7
votes
1answer
991 views

How to implement this kind of ripples with a GLSL fragment shader?

So I have already implemented the reflection part: uniform sampler2D texture; uniform vec2 resolution; uniform vec3 overlayColor; void main() { vec2 uv = gl_FragCoord.xy / resolution.xy; if (uv.y ...
2
votes
2answers
275 views

Movement on objects in 2D tile/grid based game

This question is an addition to both of these questions: Boat passing under a bridge in a 2D tile based RTS How to handle slopes/bridges in a 2d grid turn based strategy game While I get the idea ...
3
votes
1answer
681 views

Why would it be faster to render using multiple canvas elements?

This video suggests that rendering using multiple canvas elements helps performance. How does this work? The idea was to use one for the player, one for the enemies, another for the background, ...
0
votes
2answers
2k 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
289 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 ...
1
vote
1answer
302 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 ...
0
votes
1answer
110 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
109 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
33 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
270 views

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

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
432 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
220 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
840 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
22 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
75 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 ...
2
votes
3answers
114 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
182 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: ...
6
votes
2answers
707 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
512 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
170 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
25 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 ...
3
votes
1answer
104 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 ...
1
vote
2answers
208 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
272 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
88 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
393 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
123 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
496 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
78 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
250 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
393 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
96 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
424 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
100 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
156 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 ...