Questions tagged [2d]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
14 views

How do I accomplish viewing a 2D game board in 3D space?

So I'm making a 2D board game in 3D space and I don't want to use paper2D because I'm not really using sprites. What I want is to be able to make a grid of cubes positioned such that I can have a ...
user avatar
1 vote
2 answers
184 views

Line-of-sight algorithm for tile-based tactics

I've tried Bresenham line and Raycasting, but they don't quite give the results I need (examples in the screenshot). '&' - character '+' - cells that can be attacked by the character '#' - walls ...
user avatar
  • 13
1 vote
1 answer
39 views

Rectangular Collision Resolution behaving incorrectly on corners

I'm currently writing a simple game engine and encountered an error while trying to resolve rectangular collisions. When an object moves diagonally and collides with a solid object I only correct it ...
user avatar
0 votes
2 answers
31 views

Flipping a sprite with SpriteRenderer.flipx when the pivot is not centered

My sprite has a pivot in the bottom left so that it snaps on the grid. Flipping the sprite with flipX almost works, but the sprite also shifts one quare to the left/right when flipping. Gif of ...
user avatar
0 votes
0 answers
21 views

Unity 2d - Creating Temporary Objects Within the Scope Of the Camera View

I want to create one large tilemap, and want objects placed on it like multiple blades of grass and trees. I want the tufts of grass and tree objects to be placed based on specific placeholder tiles ...
user avatar
0 votes
0 answers
29 views

Unity 2D Parabolic character movement between platforms displays unexpected behaviour

I am trying to write an enemy AI that jumps between available platforms when it doesn't have ground below its feet. I want the character to do the jumps in a parabolic fashion rather than doing a ...
user avatar
3 votes
1 answer
52 views

Eliminate bouncing when switching/sticking to a different surface

I am following this tutorial to make a KinematicBody2D align to the surfaces below it. When switching from one surface to another, the character bounces until it ...
user avatar
  • 229
2 votes
0 answers
43 views

Audio emission from a polygon instead of a point

I'm developing a 2D game in Godot. The engine doesn't matter in this case. Given a polygon, convex or concave, and a listener (camera) location, what 2D position should an audio emitter be placed at ...
user avatar
  • 23
0 votes
1 answer
30 views

Remove 2D images from layer where overlapping layers hide them completely

I'm creating a 2d game (engine written in JavaScript) with layers system. I would like to have some post process to optimize the images and the layers. If there is too many images in one layer it ...
user avatar
  • 147
0 votes
1 answer
40 views

Changing Coordinate Origin [From Coord System A -> Coord System B]

I'd really appreciate some help on this one. Given 2 coordinate systems A and B where xA is an initial Vector3 position, rA is an initial Quaternion rotation xB is an initial Vector3 position, rB is ...
user avatar
  • 3
0 votes
0 answers
33 views

Replicating spring effect

I want to replicate this spring effect on the stack of popsicles in the attached video. Can you advise some tips/tutorials/ideas/articles? The main goal is so that it can wobble freely and feel more &...
user avatar
  • 1
0 votes
1 answer
52 views

Rigging a 2D face on a 3D character

I have a question about rigging in Unity -. Is there a way to rig a 2D face on a 3D character in such a way that you are able to get a smooth transition between the different keyed mouth- and ...
user avatar
10 votes
3 answers
3k views

How can I shorten the length of time spent on finding a path using my A* pathfinding code?

I am working on a game where the player and enemies move between discreet tiles, with only orthagonal movement (like pokemon). The game also runs on a turn system, so the player makes a move input, ...
user avatar
0 votes
0 answers
45 views

How to check if game object is in a trigger area

I have a 2d tilemap collider combined with a 2d composite collider to and set to be a trigger. What I want to do is check if there are any game objects within that trigger area. The catch however is ...
user avatar
  • 125
0 votes
0 answers
43 views

Problems with knockback implementation

In 2D platformer I'm having difficulty with knockback feature that happens when character touches enemy. That's implementation of it. Character.cs: ...
user avatar
  • 1
0 votes
1 answer
34 views

Achieving minigame layout within my main game

I appreciate this is a pretty broad question but I'm not sure of a way to go about this. I have read some other questions on adding minigames but they don't all quite answer what I want. I essentially ...
user avatar
  • 11
0 votes
0 answers
26 views

Unity - Circle Collider 2D traveling the side of a wall randomly collides with wall corner

I have a 2D golf game that uses a Circle Collider 2D on the ball, and I have levels/holes built out in Tiled, which I import into Unity using SuperTiled2Unity. Being a somewhat retro styled pixel art-...
user avatar
0 votes
1 answer
22 views

Position object in top left of Rect Transform 2D

I have a GameObject with a Rect Transform (I assume I should be using one) and I am trying to essentially spawn squares in a grid formation. However it starts from the middle and I want it to start ...
user avatar
  • 11
0 votes
0 answers
87 views

Single pixel disappears in outlining shader

I've recently (11 hours ago, to be precise😅) started to work with shaders and it's going pretty well. I've created a simple shader to create an outline and I tested it on a simple object to see how ...
user avatar
  • 654
0 votes
1 answer
47 views

How to build a system for ammunition being fired out of cannons when player characters and crewmates can also be ammunition?

I'm currently working in Unity building a game inspired by the niche DS game, Dragon Quest Rocket Slime. It's a Zelda-like forced-perspective top-down game where the primary combat mode is you ...
user avatar
  • 1
0 votes
1 answer
41 views

Problems with reflection angles during collision resolution between circle and rectangle vertices (2D)

I'm having a hard time trying to resolve the reflexion angles when the ball collides with one of the brick's corners (square vertices) in my brick breaker game. The collision detection system is ...
user avatar
  • 13
0 votes
0 answers
38 views

2D circle and rotated square collision detection and response

I'm creating a 2D multiplayer game in javascript, but I'm actually struggling with a problem (not really a problem, but I don't know how to do). I'm actually trying to make my player (circle hitbox) ...
user avatar
0 votes
1 answer
49 views

Player is able to interact with objects but enemy isn't able to

Newbie here, I have a player script that interacts with objects just fine and I made an enemy script for the same object and it gets completely ignored: Below there are 4 scripts. The ...
user avatar
-2 votes
2 answers
54 views

Collision callbacks not working

I'm a beginner at coding and wanted to make a quick little program to test my googling skills so far. I'm trying to make the player GameObject be given a speed boost when it collides with the "...
user avatar
1 vote
2 answers
72 views

Performance for range of effect in city builder

I am working on a city building game where all buildings are axis aligned rectangles. Currently I am using spatial hashing to detect if the insertion of a building intersects a building in the board. ...
user avatar
  • 111
2 votes
1 answer
92 views

How to animate a 2D top-down fish?

Recently I've been trying to create a controllable fish character. The game is 2D and top-down. My two approaches are: Skeletal Animation, which is versatile but looks too robotic. For example, no ...
user avatar
0 votes
1 answer
39 views

SDL2 and TmxLite (Tiled) (Reading the actual TILE data from the layer)

I am trying to make use of the Tiled Map Editor for my SDL2 projects. (By using the TMXLITE parser from Fallahn on Github) https://github.com/fallahn/tmxlite ...
user avatar
0 votes
0 answers
23 views

I am trying to make a multiplayer game, and my 2d sprite shows up when I click play normally, but not when I press build and run?

When I press the play button at the top of the screen, I can see my sprite, but not when I press build and run. Why is this? (enter image description here
user avatar
  • 1
0 votes
1 answer
62 views

Trying to move the snake smoothly in a 2D game

...
user avatar
  • 15
0 votes
0 answers
39 views

2D sidescroller water surface shader

I am implementing a little 2d fishing side-scroller as a hobby. Here is a screenshot of the work-in-progress: I have implemented a underwater distortion effect in a GLSL fragment shader, but I have ...
user avatar
  • 1
0 votes
0 answers
39 views

3D Illusion of a 2D Planet with buildings

I recently came across an interesting post on how to create the illusion of a 3d planet using 2d graphics, here it is: link It is not very difficult to create the planet itself, you add a circle, then ...
user avatar
0 votes
1 answer
130 views

Unity tilemap WorldToCell returns floored world position

I have a tilemap that is filled with tiles by script. That works well so far. Now my aim is to make the tiles interactable by making them clickable. I achieved this by adding an EventSystem object ...
user avatar
  • 3
1 vote
1 answer
45 views

Reflection Line2D

I found a video on YouTube with a sercol and a beam, and everything seems to be fine, but the beam doubles and flickers after spawning from the mirror, tell me what could be the problem, screenshot ...
user avatar
0 votes
0 answers
38 views

How to move an enemy to sneak up on the player from behind, using forces?

I have this code to move the enemy: (for x, same for y) ...
user avatar
  • 237
1 vote
0 answers
44 views

Saving Tiles in an irregular grid

I have a grid, which the user can expand as he wishes. Since I don't know how big the grid will end up (and many tiles will stay empty) a two dimensional array (...
user avatar
1 vote
1 answer
99 views

Problem with placing isometric tiles above and below each other

In unity when using the in built tale palette to place tiles into the scene, I have come across a small problem. Im using an isometric tile-map and whenever i go to place a block, I end up placing a ...
user avatar
  • 21
0 votes
2 answers
62 views

How to connect rockets to a space capsule?

I am trying to create a space capsule that has four rockets to balance the capsule. The rockets and capsule haveRigidbody2D and ...
user avatar
  • 3
0 votes
1 answer
32 views

JS 2D top down movement doesn't act as expected

I realise this is very similar to other 2D movement questions already posted but cant find a solution that fits the behaviour I'm looking for, so I'm posting in the hope that someone more ...
user avatar
0 votes
1 answer
224 views

Why do some 2D games like Hollow Knight and Ori use 3D Unity instead of 2D?

What are the advantages of using 3D in Unity that you don't get with 2D? I am creating a 2D game like Hollow Knight and Ori. When would I use 3D Unity and when do I use 2D? Would the graphics be ...
user avatar
0 votes
0 answers
191 views

Making sure the player and the camera are in the borders

What I need is a way to automatically create an invisible border around the current tilemap (tile map uses simple rectangular tiles) The player character uses ...
user avatar
  • 654
1 vote
0 answers
91 views

2D faux gravity walk/stick to a planet

I'm trying , to make a Player walk on a planet , through searching , I figured out that I can achieve this effect using Faux gravity , I tried to Implement it , but it's not working as intended: ...
user avatar
  • 229
1 vote
0 answers
30 views

trying for a Typewriter effect on a JTextPane [closed]

i'm pretty new to coding (about 5 months) and i've been trying to make a custom terminal for a text based RPG. so far i have the terminal working the way it should but i'm looking for ways to rewrite ...
user avatar
-2 votes
1 answer
680 views

Is it possible to make a 2D game using Unreal engine 5?

Is it true that UE5 can't be used to make a 2D game?
user avatar
1 vote
1 answer
72 views

Making interacting gears in 2D

I want to create mutually rotating gears for a puzzle game. I looked at a lot of material, but didn't understand how to make a RigidBody2D stay in one place correctly and interact with each other. ...
user avatar
0 votes
1 answer
57 views

How can I determine which 2d entity was selected from a overlapping pile

I'm using C++ and SDL2 to learn about coding by creating a clone of a 2d tile-based game I enjoy. To setup my problem; There can be multiple items dropped on a tile by the player or other entities ...
user avatar
0 votes
1 answer
128 views

Simulating sprite shadows for a 2D top-down game

I have read some other posts with almost identical titles on here, but they are not exactly what I am looking for. (What I have seen come up a lot in 2D shadows is some sort of "ray-cast effect&...
user avatar
  • 21
0 votes
1 answer
78 views

How to handle multiple facial expressions in Unity 2D?

I want the character in my Unity 2D game to be able to change between many facial expressions (normal, happy, angry etc.), but I don't know the best way to do this. My character will be split into ...
user avatar
0 votes
1 answer
231 views

Move camera when dragging right and left

I am making a 2D game using Unity, and in the game you see the world from the side like in the first Super Mario games. But instead of moving the camera by walking, I want to move the camera by ...
user avatar
0 votes
0 answers
14 views

Why am I getting a NullReferenceException when I am referencing the object? [duplicate]

I am getting the current following error: NullReferenceException: Object reference not set to an instance of an object. This error arises with the following line of code: ...
user avatar
1 vote
1 answer
71 views

Animation clip that acts relative to the object's current position

I am making a 2D game in Unity and I want to create an animation that works with any object and takes that object's position into account. The animation should be a little bounce, basically move it up ...
user avatar

1
2 3 4 5
68