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
8 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
75 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
  • 639
0 votes
1 answer
35 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
0 answers
21 views

Problems with reflection angles during collision resolution between ellipse 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
26 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
47 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
53 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
68 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
76 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
20 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
22 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
-1 votes
0 answers
53 views

How do I make different backgrounds in my game to randomly change

I'm creating a 2D game where there are different backgrounds. I need to know about a feature where the different backgrounds can repeat one after another randomly. I created different backgrounds in ...
user avatar
0 votes
1 answer
55 views

Trying to move the snake smoothly in a 2D game

...
user avatar
  • 15
0 votes
0 answers
30 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
38 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
49 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
0 votes
1 answer
95 views

How to make a Class of Clans style tilemap projection in Unity? [closed]

I saw some posts about the projection used by Clash of Clans, but it doens't make sense for me. I am trying make a game like Clash of Clans (in Unity with an isometric tilemap). I tried use both ...
user avatar
1 vote
1 answer
43 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
34 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
  • 217
1 vote
0 answers
33 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
69 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
60 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
26 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
182 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
179 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
  • 639
1 vote
0 answers
77 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
  • 197
1 vote
0 answers
29 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
381 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
66 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
55 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
80 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
57 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
102 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
0 answers
44 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
0 votes
0 answers
47 views

Unity 2D - How to simulate physics material 2D bounce without collision?

I like the bounciness effect you get when an object with a physics material 2d with bounciness collides with another collider and I want a similar effect in my game. The problem is that in my game ...
user avatar
0 votes
0 answers
34 views

Unity 2D - How to make vertical ground in 2D?

I am trying to make a 2d game where you drag objects with the mouse and let go of them either in air or on the ground. The air is the blue in the image below and the white is the ground. I want the ...
user avatar
-1 votes
1 answer
27 views

My Unity application is on the left side

Today I made a Unity 2D app with a square moving around and I wanted to know why is the alignment on the left. Here are some screenshots:
user avatar
  • 1
1 vote
0 answers
59 views

2D tilebased collision system

Hi i want to implement a collision system (something comparable to super mario) I would like it to have objects which can have any size (the hitbox of it) And it should be reasonably efficient (so ...
user avatar
  • 11
1 vote
1 answer
40 views

Rotating an Icon On MiniMap

I'm creating a minimap for my game. There is a mission where the player has to escort an NPC to an area. The minimap shows the player, the NPC and the location. The NPC icon sends an arrow from it's ...
user avatar
  • 31
1 vote
2 answers
46 views

How to 2D shadow image transformations

I'm writing a 2D top-view game and I will have to draw shadows. Sun will always be at North-West. My game has, for example, tanks. I have tank image and tank's shadow image: My idea is to draw first ...
user avatar
  • 125
1 vote
1 answer
72 views

My sprite is hovering slightly above my tilemap in Unity 2D

I have a simple object with a Rigidbody 2D and a Box Collider 2d, that's supposed to fall and land on a tilemap with a static <...
user avatar
0 votes
2 answers
59 views

How do I make several Image components transparent collectively as one sprite with a CanvasGroup?

I've run into a problem where using the CanvasGroup component to fade in/out several Image components under a hierarchy produces an unwanted result, where each individual sprite that overlaps with ...
user avatar
0 votes
1 answer
42 views

Changing part of a sprite in 2D game

Let's say I have a character and certain things (shoes, vest, hat, etc.) can be changed (visually, just the color changes). What came to my mind was creating each of them as a separate sprite and then ...
user avatar
  • 639
0 votes
2 answers
95 views

Height in 2D game

I'm working on a 2D top-down game (like the picture below) and am wondering what can I do for "jumping" So far, I've done these: adding two events in jumping animation (one for when the ...
user avatar
  • 639
0 votes
1 answer
46 views

Draw a graph as a world map in UI?

What's a good way to take a graph of nodes and draw it in your UI as a map? I already have a graph and I'm happy with how it's generated. However, it doesn't have any positional data for the nodes -- ...
user avatar
  • 417
0 votes
1 answer
434 views

Keep aspect ratio on window resize in Unity

What is my problem? I have started a new 2d game project in Unity and would like to allow for resizing of the window by the player. When resizing, I don't want black bars at any of the 4 sides (I ...
user avatar
2 votes
0 answers
44 views

Unity 2D Sprite Cutout with border

I'm working on a 2D simulation game and have one object floating on top of another one. I have a Sprite Mask on the object on top to achieve cutout like effect so the background is visible where the ...
user avatar
1 vote
1 answer
47 views

How do I apply real time physics to a 2D game in Java?

I'm developing a 2D Brick Breaker style game in Java and want to apply some real time physics to it, especially to the paddle/ball interections. Nothing too complex; just applying some of the physics ...
user avatar
  • 13
0 votes
0 answers
51 views

Best Pathfinding solution for 2D action-platformer

I'm developing a 2D action RPG with heavy platforming. The combat system and movement take inspiration from Hollow Knight and the Smash Bros saga. I would like to have some type of enemies with really ...
user avatar

1
2 3 4 5
67