2D refers to two dimensional space where coordinates are represented with X and Y values.

learn more… | top users | synonyms

1
vote
1answer
36 views

Unity RaycastHit2D sprites error C#. Figured out that this code only works on 3D colliders so how do I change it so that I can use it on 2D colliders?

Figured out that this code only works on 3D colliders so how do I change it so that I can use it on 2D colliders? Below is the c# code. using UnityEngine; // This script allows you to drag this ...
0
votes
0answers
37 views

LwJGL 2.9.3 2D Camera

So I've been messing around with cameras in 2d. But I came across a weird bug and I was wondering if anyone could help me figure it out? public static void createDisplay(String title, int width, int ...
0
votes
2answers
31 views

Getting input from just one Axis at a time

I'm trying to make a CharacterController2D Script for a simple 2D TopDown game, but i was wondering, what would be the best way to disable 2-axis movement? just allowing one direction at a time (Maybe ...
0
votes
1answer
116 views

Comparison of two 2d top down player movement scripts in Unity [closed]

I have been following along two different tutorials on making an 2d RPG and comparing the two movement scripts that seem to do the same thing but in different ways. Which is a better way when ...
0
votes
0answers
37 views

LineRenderer doesn't apply material in 2D Unity5

I'm making something that draw lines with mouse on top of everything (in 2D), but the color of the line is always purple even though I assign a material to the line renderer. I could change the color ...
3
votes
1answer
88 views

Why is quad rendered at the center (0,0) instead of top left when using orthographic projection

I have been trying to render a quad(containg a texture) using orthographic camera so that the quad can be rendered using the screen coordinates directly. I started of by rendering just a triangle ...
2
votes
1answer
163 views

How can I adapt A* pathfinding to work with platformers?

I have an A* implementation that works in "top down" situations where gravity is not taken into account for pathfinding. But, I am looking to modify to work in a 2d platformer situation. I am using ...
5
votes
1answer
115 views

On a 2D generated terrain what is the easiest way to pick tiles for the shoreline?

If I have a two-dimensional array with ones and zeros for water and land respectively how do I choose what shoreline tile to use according to the water and land tiles surrounding it? The shoreline can ...
0
votes
0answers
12 views

If I attach a RunAnimation to my Player and move it, the Camera starts to freak

If I make a RunAnimation for my Player in 2D, then there is one Spot it works and I can move perfectly but if I move my Player to a different position,my Player stucks in Midair and my Camera starts ...
0
votes
1answer
67 views

In Game Maker Studio, why does the image rotation have to be performed every step?

I'm a software developer who's trying to get into game development casually on the side. I picked up Game Maker Studio a while ago on a Steam Sale, and I'm finally getting into using it, especially ...
0
votes
2answers
58 views

How do I stop the player from rotating when they collide with a tile?

I use Touch movement and if I jump and hit a corner with the feet of my player, my player rotates but I don't want this. Can anyone help me jumping without rotating if I hit anything ? here is my ...
0
votes
0answers
40 views

How to Implement a 2d camera object for a side scroller game

Ok so Heres the problem. I'm Using c++ with sfml for graphics and box2d for physics. I've tried an ultra simple cam movement in the past where i lock the player to the center of the screen and offset ...
1
vote
2answers
53 views

Instantiate a 2D GameObject in certain direction

I'm working in a Top-Down 2D Game, and i'm trying to avoid the use of rigidbodies and rotations, i manage the direction the player is facing via input and changing the sprites, but right now, i dont ...
0
votes
1answer
44 views

Why do my obstacles float above the ground? Unity2D

I'm making an infinite runner game and I'm trying to spawn obstacles, but all of them float far above the ground instead of being at the ground level. This is the code on summoning the bears. ...
0
votes
1answer
29 views

How does this point2LineDist() method works?

I was browsing Wolf3D JS port and bump into that method : /** * @description calculates distance between a point (x, y) and a line. * @memberOf Wolf.Math * @param {number} x X coord of point * @...
0
votes
1answer
62 views

Trying to make a 2D Spring

Still a Beginner at Unity 5 and this time I am trying to make a Spring. The spring would act as you'd expect. Something comes in with a direction and force, so you bounce it the opposite direction of ...
0
votes
3answers
67 views

How do I flip Player in 2D Touch Movement?

How do i flip my Player in 2D when i got touch movement? I got Buttons to move but how do I flip the player now if i walk to the right cause my player faces to the left..? here is my Player Script: ...
5
votes
2answers
586 views

Why would one use a separate alpha mask for sprites?

I've seen tilesets of the game Braid, and for each tileset in the main folder there is an alpha map for it in "alpha" folder. I wonder, why just not to draw your image as it is (with transparent ...
-4
votes
2answers
151 views

2D Game Development Software that can release your game on Steam [closed]

Im looking for a game development software that can also publish to steam, I know most can but some come with an additional fee and some without, I think the Cryengine allows you to publish to ...
2
votes
2answers
63 views

Java: problem with 2D corner collision

:) It took me many days to create a working collision detection for a 2D java platformer... I am finally calculating the corners of my player but the system is still buggy and I hope that we can ...
3
votes
1answer
120 views

Why flip sprites instead of creating extra assets?

Why is the preferred method for changing the direction a character is looking in a 2D game a sprite flip? Why not just create the extra asset and show that one on screen?
1
vote
1answer
138 views

Unity 2D Diablo style movement

I've made a totally new scene for a 2D mobile game. I placed a sprite on the center of the screen and attached the following script onto it (this is basically a diablo-style click-to-move control ...
0
votes
2answers
110 views

How can I prevent 2D teleportation from teleporting through solid objects?

In my 2D game, the player is able to teleport to any place on the screen with the click of the mouse button. What I am trying to prevent is the ability to teleport across solid objects. If the point ...
0
votes
2answers
49 views

Unity UI issue trying to make a button work while held down

Pretty simple, have a rotate up button and I ant it to rotate while held down. using UnityEngine; using System.Collections; using UnityEngine.UI; using UnityEngine.EventSystems; public class ...
1
vote
1answer
88 views

Unity sidescroller with 3D objects/environment. Should I create a 2D or 3D project?

I'm looking to make a side-scroller in which the camera and all objects can only move in the x and y directions. However, I'm going to have all objects and environments as actual 3D models. Is it ...
0
votes
0answers
42 views

My Movement Function is working good but called only once

I have a function, It's working but not getting called every frame if It's in canMoveDown function but !canMoveDown its not. if (!canMoveDown && UpdateTilePhysics(currentBoardPiece)) like ...
-1
votes
2answers
119 views

How can I implement Player Prefs to Save High scores in unity?

I am new to both unity and C# and facing trouble in saving and displaying the highscore.text in the game.Til now I only successfully managed to display the scoreUI and update them whenever player ...
-1
votes
2answers
127 views

Inconsistent AABB collision detection

I'm making an endless jumper as my first game and I'm running into some problems with the one-way collision detection. Collisions are detected correctly most of the time but occasionally the player ...
0
votes
2answers
182 views

How can I move an object around a canvas in a random direction at random times?

I am currently trying to move an object (circle ball) around the canvas in a random direction. I have already written the code for the wall collisions so the ball bounces back into canvas when the ...
0
votes
0answers
80 views

Filling polygons with texture/color using SDL2

I recently went on to making a 3D software renderer using SDL2 and Rust as a learning project. It has been going quite well, it can draw lines, polygons, and cubes. Now, it can only display ...
0
votes
2answers
111 views

How to fix my tile-based game's tile movement code ? (like a CandyCrush Style)

I'm currently creating a tile-based game like a CandyCrush style direction movement (no problem on only down movement) trying to smooth, not laggy tile movement with a board piece, and I'm writing a ...
1
vote
1answer
75 views

Java - Adjusting the speed of an object during movement

I am trying to get an object to move (on java canvas) in the same angle but at different speed within the X and Y axis. Below you can see how i have implemented the movement of the object. xPosition +...
2
votes
2answers
67 views

Rigidbody2D Circular Orbiting

I am trying to create a basic solar system in 2D. All space objects has CircleCollider2D on them (which are required for raycasting in another script). Currently planets are childs of stars, and ...
4
votes
2answers
179 views

How to resolve push block physics in a 2D side scroller puzzle

I've been working on a 2D tile-based side scroller puzzle game in Unity with obstacles such as doors, keys, fans, portals, etc., but one type of obstacle, push blocks, is giving me some issues. Here ...
0
votes
0answers
39 views

Adding a 2d collider causes incremented movement of a child, how to fix it?

I have 2d game, with a parent object with two sprite children, a man moving up and down with a flamethrower. Currently having only the movement script and rigidbody, I can move the parent easily with ...
0
votes
0answers
68 views

Responsive animation based on mouse position

I'm currently developing a topdown 2d rogue-lite game in Unity, where the combat will be mainly focused on archery and different adaptions based on archery. My problem is that I have a hard time ...
9
votes
1answer
154 views

Screen tearing in fragment shader on R9 380 GPUs

two players are encountering an issue with my game where the screen is tearing when it uses a fragment shader but it only seems to be doing this for players with a R9 380 GPU. Here is what it looks ...
0
votes
1answer
69 views

What is differential scrolling?

I have seen the term a few times (e.g. here). I tried looking it up but did not find much information. I thought it would be something like parallax-scrolling, but I have seen suggestions otherwise (e....
0
votes
2answers
134 views

Picking a 2D Box Collider with the mouse in Unity

I have a scene with a bunch of 2D doors that have 2d Box Colliders (no trigger) on them and that live on a Canvas. I would like to be able to click on them with the mouse, but have had no luck. ...
35
votes
2answers
4k views

How can I procedurally render irregularly shaped health bars?

The issue of the traditional rectangular or heart-based health bar is something well-understood and easily solved. But what is the accepted solution for more "creatively-shaped" health bars, like the ...
0
votes
1answer
67 views

How to calculate acceleration and deceleration

I have a car with speed x, and can accelerate at a rate of 0.5 m/s^2, and can decelerate at a rate of -0.1 m/s^2. Maximum speed is 20 m/s. To accelerate the car speed, at each frame I need to do: ...
-1
votes
2answers
268 views

How can I render 2D ropes in Unity?

I'd like to be able to render flexible lines, or ropes, as below: I thought about using a Line Renderer but it doesn't have the flexibility to render arbitrary curves.
0
votes
1answer
83 views

Enemy shake/vibrate when following character

I am using the arongranberg A* path finding project to create way points for one enemy to follow the player. However, the enemy vibrates back and forward by about 0.1 - 0.2 unit distance when moving. ...
0
votes
0answers
21 views

Simplifying grid based intersection checking to not need 16 checks from each corner

I'm working on an "underground prisons and fire breathing lizards" inspired CRPG. So far I have implemented a "path drawing" method to, well, show the grid cells that would be involved if one were to ...
0
votes
0answers
65 views

MonoGame RenderTarget2D mipmapping fades textures when zooming out

I recently ported my XNA game to MonoGame. Unfortunately, some of the textures are being faded when: They are scaled-down from 32*32 to 16*16 When the camera zooms out, the texture fades from ...
0
votes
0answers
141 views

Unity2D Script to Throw Object to hit the TARGET everytime?

Hi I got a script that fires object at a target. In this instance, I have an enemy that fires an object towards the player! But I am stuck how can I get the required force to always hit the target no ...
5
votes
1answer
227 views

What is best method for 2D pathfinding in procedural world?

I have been researching path-finding for 2D games and would like to create a system that allows A* to perform as best as possible over a near infinite world. This system is intended to manage not only ...
2
votes
1answer
147 views

What is the advantage of pixel coordinates for a 2d game?

From the Godot feature list: Work in pixels as your units, but scale to any screen size and ratio. And reading the documentation they also use pixel coordinates to update the position of objects ...
1
vote
1answer
184 views

How to get a pixel color from a specific sprite on touch (unity)?

I have a 2 layers of a different sprites. How can i get a pixel color from lower sprite? I know how to get touch and world coordinates, but i have no idea what to do next. Touch touch0 = Input....
3
votes
1answer
67 views

Dynamically generating triangles from points

I'm working on 2D lighting. I have a list of points that have been calculated and when I draw lines from the light origin to the point it works. The problem is connecting the points into triangles. ...