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

learn more… | top users | synonyms

1
vote
1answer
20 views

How to target moving object in 2D game

I am working on targeting system for 2D game. Two objects move in space. Each one have Position and Velocity vector. Ship object shoots moving objects in space. Ship can shoot in any direction, but ...
0
votes
1answer
44 views

Best way to manage weapons as GameObject on a script in Unity with C#

I have a player game-object with a script Player. In the Player script I have a public properties weapons. I want to have to just drag in this properties a script/prefabs. And the Player script must ...
0
votes
1answer
57 views

Rotation and timer at the same time

I have a project where I flip a card after 5 seconds, then I want to start a countdown timer of x seconds. After x seconds the card flips again. I found a good example for the timer here, but that ...
1
vote
2answers
38 views

Need help with physics 2D Unity

I'm making a 2D game in Unity. Basically there's just a rocket that goes where ever the user touches. With the code that i have right now, the rocket instantly rotates towards the point and moves ...
1
vote
1answer
156 views

How do I make my main character move towards an object? LibGDX/Java

What I want to happen is for my player to bounce from spring to another. For example take the illustration below: Here's my code (what I've tried to do so far). This gets called in an ...
2
votes
1answer
2k views

Why is my deferred lighting implementation so expensive?

I've implemented deferred lighting and I tried to put about 20-26 lights on the viewable space of my map, and it brings down the FPS from 61 to 28-31. It also makes my VGA temperature to go from 68°C ...
1
vote
2answers
33 views

Vision Cone for Enemy AI in Unity 2d

I am trying to develop an Enemy AI with vision cone in unity 2d top down game, can you please suggest me some approach or sample script, so I can get an idea.
0
votes
2answers
57 views

Orthographic Camera settings for a 2D game

I'm starting out a 2D wrestling game in Unity 5 and i need some help. The default resolution of game needs to be 320x240. The background sprite that i would be using is 640x480. The camera would move ...
0
votes
2answers
323 views

Basic 2d platform collision detection algorithm has a slight bug (Java)

I'm trying to implement collision detection between Player (the main character) and a Platform. They are both modelled as rectangles; when player hits the side of a platform he should bounce off it ...
0
votes
1answer
15 views

Rotating 2D-Projectile towards mouse, hides the projectile (Maybe changes the layer)

I want to shoot towards my mouse, which is working fine now. After this was solved, I wanted to rotate the projectile, so that it's looking to the mouse. This is my code: projectile.transform.LookAt ...
1
vote
1answer
74 views

My bullet changes the velocity depending on where I click

I want to build a little 2D-Sidescrolling shooter and I'm now at the shooting script. I already figured out how to shoot a bullet towards my mouse pointer. I got something like this : Vector3 ...
2
votes
2answers
57 views

2D multiple circle collision response

I'm trying to implement simple 2D circle collision system. There are circles with different radiuses and velocities (the larger the circle the slower it is). Contrary to all the questions on the ...
0
votes
2answers
269 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 ...
0
votes
3answers
96 views

Procedural generation of stars in the background with given random seed

I want to generate stars (actually a 2d vector) in the background. The player is moving left and right endlessly. When the player moves the stars, which aren't in sight anymore, should be deleted from ...
0
votes
1answer
179 views

Adding a small slide when player releases left/right key

The aim is for the player object to slow down and stop instead of just stopping dead. The following codes works ok when the player is not jumping, but gets stuck in an object if the player is in the ...
1
vote
1answer
899 views

Spritekit - gradually apply force vector in different direction (space ship turning)

I have a space ship that I'm applying a force vector to using a joystick for control. I would like this to smoothly fly around when I'm switching directions.. Exactly like minisquadron if you've ...
0
votes
1answer
37 views

Game maker or unity for 2d games [closed]

I'm new to game dev but I know how to code. I would like to try my hand at making a 2d game. I am overwhelmed by the ear between unity and game maker. Which one would be better to use. I thought unity ...
0
votes
2answers
36 views

How to access Collider in c# script with its tag name

I want to access a Collider in c# script file with its tag name I Tried this if (Collider2D == Physics2D.OverlapPoint(touchPos)) { Some Code to be Performed } I want to access this Collider2D ...
0
votes
0answers
31 views

How to make a 2d game using java netbeans? [closed]

I'm an IT student, but my problem is my professor is just giving us codes but not explaining what is it for. Now, in our finals, our finals exam is we'll be making a 2d game using java. And I have no ...
1
vote
1answer
60 views

2D World - How to represent my Game Objects graphically?

I want to code my own topdown 2D game with SFML+C++ that later shall have multiplayer functionality. Therefor I want to seperate the graphical and logical Parts of my game. All of my ingame Objects ...
11
votes
1answer
2k views

What is the difference between an impulse and a force related to a physics engine?

What is the difference between an application of an impulse and an application of a force in relation to a physics engine?
0
votes
1answer
51 views

Touchscript: multiple overlapping colliders

Im building a tower defense game on unity and would like to allow the player to pan the camera on a large map. I am using touchscript to handle the touches. I made a testing project with the ...
0
votes
1answer
46 views

Change sprite to animation in unity 5 2d (c#)

I want to do the same as this older post with one change: Change the sprite of a Object in Unity I want to use a .anim animation (created with unity) after the space key is pressed instead of ...
1
vote
1answer
44 views

DX11 Mixing 2D and 3D

So I am somewhat new to working with DirectX rendering, and I have done some 2d and 3d work. I am planning on working on a new application where I will be rendering a bunch of 3d scenery, and then ...
2
votes
1answer
202 views

Create a 2D orbit trajectory like in angry birds space and a circular orbit

I am working on a 2D game, and I am working on adding some space physics : I need to find a way to create a circular orbit and an orbit like angry birds space ( the spiral trajectory ) . So there is 2 ...
1
vote
1answer
70 views

Isometric Terrain Editor

I am trying to make an isometric terrain editor. My problem is not to do with making isometric graphics or rendering them, rather it is to do with indexing of tiles. Let's say I'm making a hill at ...
2
votes
3answers
173 views

How to select random points within grid meeting min/max distance requirements from each other?

I have a 2D grid map that is relatively large. I'd like to pick some semi-random points all over it (say N points). The rule I want to ensure here, though, is that any selected points are at least M ...
1
vote
1answer
628 views

How to create water with ripples in custom places for top down game in Unity?

I want to make topdown row boat game with Unity. I want graphics to be simple (sprited), but the water must be "very nice" and realistic and it should reflect movement in it (paddles and boat movement ...
0
votes
1answer
58 views

Unity Quality Reduction only reduces my player sprite quality

I created a small map in tiled then imported it into Unity. A small sprite character is controlled by the player to roam about the map. I am experimenting with this for University and wanted to see ...
2
votes
1answer
579 views

Phaser / PIXI: World size vs. Stage size

I am using Phaser to build a zoomable / pannable 2D map with the intended functionality being that the home camera position is always in the middle of the World coordinates. I have a problem where my ...
2
votes
4answers
521 views

Moving camera, or camera with discrete “screens”?

I'm making a game with a friend, but having trouble deciding on a camera style. The basic idea for the game, is having a randomly generated 2-dimensional world, with settlements in it. These ...
0
votes
1answer
103 views

Player position on second player connection

I'm having some trouble trying to run my game for the multiplayer part. I'm creating a 2d game. I have followed this tutorial : ...
0
votes
1answer
149 views

LibGDX - Executing 2 different touchDown events in the same method

On the bottom left of my screen is a circle with an Arrow and on the bottom right is a circle with a gun. If the player is in jetpack mode and the Arrow "button" is clicked he flies like flappy bird ...
0
votes
2answers
247 views

Basic C# Script in Unity3D for firing a bullet (not working)

working on a 2D top-down view game. Im trying to get my player to fire a bullet when spacebar is pressed. I added a component to my player (a bullet sprite) and placed it under his gun (so you can't ...
2
votes
1answer
58 views

Short distances from reference point

I would like to compute short distance from reference point in 2d grid. To expose: 0, 0: not penetrable 0, 1: not penetrable ... 1, 1: penetrable ... I search an algorithm who return: 1, 1: 1 ...
7
votes
2answers
222 views

How do I letterbox a C#/Monogame viewport within a resizeable window?

I am making a 2d game with xna/monogame. I want the main view area to always show 15x15 tiles, or 480x480px. I've got something that sort of works, following this guide. It expands the view range ...
0
votes
1answer
28 views

Importing .anim files created using the Unity Animation controls

Our artist created some .anim files using the built-in Unity Mecanim system (where you use keyframes and drag various body parts to construct the animation). However, now we're trying to export them ...
3
votes
1answer
102 views

Retro Racing Renderer

While I have a lot of experience with coding SW&HW 3D rasterizers across multiple platforms and eras, I never got to coding a 2D renderer for a non-polygonal racing game with multiple rolling ...
0
votes
0answers
11 views

OpenGL HUD is flickering when rotating the camera

I draw game HUD after drawing 3D scene. When I move the camera quickly, HUD starts flickering. I noticed that it happens only if the distance between the camera and an object its looking at changes ...
-1
votes
1answer
33 views

How do i move a 2D object with angle and speed variables in unity?

I want to move an object with a certain angle and speed, is there a was to set this as an initial velocity so that it is still possible for the object to collide and bounce of other objects using its ...
0
votes
1answer
44 views

handle mousedrag() for two different game objects individually in 2D environment

I am developing a pong game for android mobiles having 2 slider and want to assign movement of individual slider corresponding to its current position I tried some code for the movement of these ...
0
votes
1answer
92 views

Draw GUI.Button on certain position on a scrollable background

Problem is in a 2D game I have a large background around 2 screens wide. And on there I got 4 buttons placed on top of background all over complete width. Now when I swipe of move my mouse around I ...
1
vote
1answer
64 views

How to calculate faces involved in collision (Separating Axis Theorem)

I have a game engine created in javascript (https://jsfiddle.net/4gqsq8wf/) which uses collision detection via the Separating Axis Theorem. Currently, it does not have any means of resolving velocity ...
1
vote
1answer
70 views

How do you make a Pong slider using touch events for mobiles?

I am stuck with an issue of moving the slider on android mobiles with finger touch event while developing pong game in unity 3D, though its working fine for pc. This game is developed in 2D ...
0
votes
0answers
32 views

Hide back button bar of android mobile while playing game

I just want to hide back button bar of android mobile while playing the game. I tried to make it close by pressing back button,it getting close but its always visible. please help..
0
votes
1answer
74 views

[Unity]Making sure playermodel only moves 1 unit

I am doing a school assignment based off of the Unity3D tutorial 2D RogueLike (all code available here) In my version though, the movement is not turnbased and I am having some trouble figuring it ...
1
vote
1answer
157 views

Why my dynamically generated Sprites overlap?

I'm trying to dynamically generate scene representing chess board made from sprites. I'm using two textures for these: - pieces.png (taken from here: ...
0
votes
1answer
40 views

current value of x for vector2 game object

I just need to push my game object in y direction not in of its x position,I need to assign it a new position but unable to access its current x position value so that can make it fix on its x ...
3
votes
1answer
69 views

Why does Unity increase the size of image when I use the image in Unity?

I try to make a game in Unity 2d. But when I drop the image in Unity the image size increases 3 or 4 times. Can I fix that or is this normal?
2
votes
1answer
268 views

What is the correct multiplication order for a 2D matrix?

I'm currently trying to create a camera and entity/model matrix for my 2D game similar to that of Unity3D. I've already tried to find answers to this question on stackoverflow/gamedev but i couldn't ...