Questions tagged [2d]
2D refers to two dimensional space where coordinates are represented with X and Y values.
3,344
questions
0
votes
0
answers
13
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:
...
0
votes
1
answer
18
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 ...
0
votes
0
answers
17
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-...
0
votes
1
answer
18
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 ...
0
votes
0
answers
79
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 ...
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 ...
0
votes
1
answer
36
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 ...
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) ...
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 ...
-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 "...
1
vote
2
answers
69
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.
...
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 ...
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
...
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
0
votes
1
answer
57
views
0
votes
0
answers
31
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 ...
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 ...
0
votes
1
answer
53
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 ...
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 ...
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 ...
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)
...
1
vote
0
answers
34
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 (...
1
vote
1
answer
71
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 ...
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 ...
0
votes
1
answer
27
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 ...
0
votes
1
answer
186
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 ...
0
votes
0
answers
180
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
...
1
vote
0
answers
78
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:
...
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 ...
-2
votes
1
answer
401
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?
1
vote
1
answer
67
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.
...
0
votes
1
answer
56
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 ...
0
votes
1
answer
84
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&...
0
votes
1
answer
58
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 ...
0
votes
1
answer
106
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 ...
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:
...
1
vote
0
answers
45
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 ...
0
votes
0
answers
48
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 ...
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 ...
-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:
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 ...
1
vote
1
answer
41
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 ...
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 ...
1
vote
1
answer
73
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 <...
0
votes
2
answers
65
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 ...
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 ...
0
votes
2
answers
97
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 ...
0
votes
1
answer
48
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 -- ...
0
votes
1
answer
453
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 ...
2
votes
0
answers
47
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 ...