# Questions tagged [2d]

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

3,344 questions
Filter by
Sorted by
Tagged with
1 vote
112 views

### Which algorithms to use for drawing procedural paint splatters?

I want to create procedural paint splatters on textures. I want somewhat similar effect like in Splatoon 2. I think I need to modify albedo image - drawing splatters there. Right now I came up with ...
• 145
1 vote
26 views

### A concise set of equation of physics that handles basic 2d physics for acceleration?

I am making an Asteroids clone and I want to implement proper physics for the objects. What equations would I use to calculate the acceleration? For example, I have a ship, and it might have ...
120 views

### Issues using Physics2D.Linecast for Movement Collision

It's quite possible I'm missing something obvious (I'm still rather new to this) despite checking the documentation, but I'm at my wit's end with this issue. I'm attempting to add simple linecast ...
171 views

### 2D side-scroller game : smooth noise transition between biomes

I'm creating a little terraria-like 2D side-scroller game with TypeScript. Currently, I divide parts of the world into biomes, which each have their own properties (flat, mountainous terrain, etc.). I ...
172 views

### Floats vs. Ints for position and collision

So I’m writing a player class and using floats to store the positon and velocity (Vector2) as well as using it when drawing. When it comes to collision I get the player bounds using this code: ...
• 63
33 views

### How to add level-by-level game camera following in 2D java game?

I've been working on my first game recently, and I've built a player tracking camera that works great, but my goal for the game would be to have a camera that is fixed for each area that the player ...
1 vote
128 views

### Simple Unity 2d pixel art animation - Why is my sprite distorted and moved to the right when animated?

Need some help w/ weird problem during basic 2d animation. I have the following hierarchy: Where ritual is animated to translate deerhead up and down, shift color of pentagram, and pentagram is ...
• 143
38 views

### How to update multiple sprites

I have a game, with multiple sprites for a player. It includes animations and etc. Player can walk, kick, defend, be hit, etc. Now I developed new sprites to substitute the old ones. One way to change ...
• 101
555 views

### Why is my UI not working on android but works perfectly on PC?

I tested my game for the first time on mobile and the UI almost doesn't work. I use if(!EventSystem.current.IsPointerOverGameObject()) to check if I'm clicking on ...
33 views

### text - part of the sprite or dynamically generated

I am trying to reproduce the same stamping tool as the one we found in the video game "Papers, Please". In my case I want my users to be able to modify the text they are going to stamp. I ...
21 views

### How to ensure that a randomly-generated velocity vector moves the camera forward within a valid arc?

I spawn a camera in a scene using random coordinates for x and y and setting z=0 and orient ...
• 101
86 views

### How to mask 2D tile sprites

I want to use masking technique to be able to reuse tiles. Basically I have the base texture and an array of masking textures for different corners and positions and want to combine the two to get a ...
• 63
1 vote
308 views

### Godot cutout animation with skeletons and ragdoll physics

i'm following the tutorial for cutout animation, but also wanted to combine ragdoll physics from this video, my goal is to make a 2d fight game with this 2 techniques. but not sure how to combine them ...
• 61
45 views

### Platforms are gradually being spawned further and further away in the Z-axis in a 2D Endless runner game, until they spawn behind the camera

I am creating a 2D endless runner game, where new platforms get spawned when the player reaches a certain distance to the last platform spawned. The issue that I found was that after the player ...
137 views

### How to manage a lot of items on conveyors

I am making some sort of factory game (topdown 2D) where I will have machines outputting items on conveyors. I was wondering what was the best approach to manage the items on the conveyors. There are ...
99 views

### 2D - How to make a gun muzzle aim at the mouse when the rotation pivot isn't on the muzzle?

I'm making a simple 2D shooter game in pygame and I've come across an issue when making the character aim its gun at the mouse. To make the gun aim up and down, I've set it so that the gun uses the ...
1 vote
138 views

### 2D vs 3D mobile power consumption in Unity [closed]

For an optimised and playable game written for mobile with Unity, how much of a difference is there in power consumption between 2D and 3D? Assuming: Unity game engine The game requires constant ...
• 13
99 views

### How to check what tile the player is standing on?

My goal here is to write a check of some sort in my playerMovement script so that I can check the name of the tile the that the bottom-middle of the sprite is located in on the tile map, from there I ...
19 views

### Sprite sorting is working fine but tilemap sorting is working the opposite way I want it to [duplicate]

I provided some screenshots to display what I'm talking about. The blue tile is a sprite, and the bushes are made from tilemap, each being 4 16x16 tiles. My transparency sort axis is set to 0,1,0. I'...
30 views

### Why aren't my Vector3 comparing correctly?

I have a machine and a I want to check if I can place a conveyor at its connexion point. I do it by checking if the machine is at the expected Input position of the conveyor and if the conveyor is at ...
958 views

### Invert the colour of pixels where 1 bit sprites are overlapping

I have a simple scene in Unity that makes use of some simple art that uses either white or transparent colours to create a 1-bit art design. The image below shows this. I want to have a that if two ...
• 143
1 vote
23 views

### Libgdx tiles get overlapped on render

I'm trying to create a Tilemap with 64x64 textures which follows this configuration. ...
1 vote
280 views

### Godot distance between 3d and 2d nodes

Godot has the distance_to methods for Vector3 and Vector2 but what would be the best way to ...
• 201
23 views

### how would i make a sprite go in front and behind a 2d wall? [duplicate]

I've tried a few solutions but none seem to work. first, I tried adding half of that same sprite onto the original and then making the layer higher, which would work, except my original sprite can ...
• 15
37 views

### How to make the enemy only start pathfinding when player is within certian distance [duplicate]

Im using A* pathfinding and unity 2d. Also im very new and dont really know how to code well so if you can tell me the code it would be much appreciated. I figured out how to use A* but i dont want ...
38 views

### Can inserting/removing one point in a quadtree or octree cause multiple splits/collapses?

I was reading Robert Nystrom's Game Programming Patterns website and, in the section about spatial partitioning, particularly in the section on quadtrees, he mentions: Objects can be added ...
• 157
32 views

### Make platformer character stay in the air at the top of a jump

I have a player who can jump. I want the character to stay in its position and not fall to the floor. This is the code I am using so far: ...
• 11
917 views

### Stop 2D platformer character from sliding down slope

I'm making a 2D platformer game with the default Unity 2D physics. I am implementing slopes, but my player slips down the slope because of the physics. Here is the code I use for the player movement: ...
74 views

### Scrolling the map in a 2D a tiled game

I am making a small game where I store information about the world around the player (like tiles) using a small 2d array of integers. In the game you can scroll the screen to the left or right. I also ...
73 views

### Placing a circle as close as possible to a specific coordinate without overlapping another circle

I am working on a 2D game in Java. My goal is to place a ball as close as possible to the center without overlapping the balls that are already there. How can this be done?
197 views

### Rigidbody not working properly

I have two objects: a player and a wall. The player is passing through the long side of the wall but it collided with the short side of the wall. I want the player to collide with whole wall. Here is ...
• 11
306 views

### Networking a fast-paced game (2D) - Forced Movement - Server / Client

I started a new project, a fast-paced online game (some sort of 2D MOBA). I encountered a problem with the part of netcode about client prediction & server reconciliation. Game Mechanics: 2D - ...
1 vote
255 views

### Move 2D Rotating object in its facing direction

I have a 2D object that constantly moving forward (in the direction its facing). So initially its facing right, and moving right, but as the rotation z-axis changes, so should its direction. Most of ...
• 125
259 views

### Identify when Unity Button Enters Pressed State

I am trying to create a UI Button Prefab with a text child element that I would like to use all over my application. Its intended behavior is very simple: Its size would be dependent on the text's ...
154 views

### How to rotate multi-tile structure on grid?

I need to be able to place structures in my game that span multiple tiles and can also be rotated. My idea on how to solve this would be to use 2D arrays that hold data about the structure. EXAMPLE: (...
• 509
1 vote
455 views

### Help me Make Sense of Unity 2D Resolution Management

I am trying to set up an environment for a retro style pixel art game in Unity 2D. I aim for a vertical resolution of 240 pixels, and then, I would like the horizontal resolution to be dependent on ...
4k views

89 views

### What is the difference between libraries like C++/PDCurses and SFML?

I have read that PDCurses is a library that can be used to create 2D games however SFML is also a library but they are not in the same category I presume according to what I have read: "The ...
310 views

### What does Polygon2D's polygons property do?

Godot Polygon2D class has a polygons property of type Array. The documentation -at the time ...
• 18.5k
54 views

### How to stop a decelarating object?

I am programming a 2D game. When a ball is launched it should decelerate and eventually come to a stop. I have implemented the deceleration part but when the ball nearly stops it starts accelerating. ...
1 vote
339 views

### How to display the counter in pygame.time.set_timer?

in pygame, we use pygame.time.set_timer() to repeatedly create an event. This function takes 2 arguments : the event type and the delay time after which the event ...
• 216
204 views

### How to get light level (brightness) of a particular location?

I'm making a 2D top-down survival game similar to Rimworld, I'm trying to emulate a day-night system. Many features depend on whether any tile is light (or dark) ...
• 509
691 views

### How to implement pixel art lighting as in the game Project Eastward?

Project Eastward Lighting Demo Can somebody point me to the right direction as to how this lighting is done to recreate this lighting effect? The game is 2D but uses a 3D lighting system.
56 views

### How to properly overflow 2D coordinates on an overflowing/circular map?

I made a simple Snake game designed for trying Snake bots. I thought the base map functions work, but now I found there is an error. What I need is to properly translate any coordinates outside the ...
1 vote
77 views

### How to decide which Area2D is behind?

How to make an Area2D drawn after another one only in certain situations? The boat + Area2D |_ AnimatedSprite The stone ...
• 663
90 views

### 2D Isometric Movement - Move to Mouse Position

I'm developing a 2d isometric game on a engine made by myself (as a way to practice Java), however i'm stuck on what it seems to be a math problem. I wish I could have some help on how to implement a ...
222 views

### How to create 2D platformer maps without a game engine's editor?

I've been developing a 2D shooting platform videogame for the Sony PSP console using only the ONELua interpreter for the Lua programing language (since there is not any game engine for it). Despite ...
56 views

### How to handle player slowness while moving up and down in a Top Down game with angled ortho camera and angled sprite due to stretching of ground?

So i'm making a 2D top down game setup in 3D using tilted Sprites and angled orthographic camera. My camera setup is as shown. In my game I have the floor flat on the X/Z plane with walls/characters ...
1 vote