Questions tagged [2d]
2D refers to two dimensional space where coordinates are represented with X and Y values.
3,344
questions
1
vote
1
answer
73
views
How to best simulate the space in a boxing game to account for footwork and angles?
When trying to prototype a (top-down, so far) boxing simulation I've run into a huge roadblock with trying to set the space in which the boxers will fight, because it's important for the fighters' ...
1
vote
1
answer
30
views
Dynamic Sort order For walking in front and behind stuff
I'm using tile maps, and I'm having a difficult time with the concept of walking both in front of things, and behind things and having the layers sort order show properly. Take the image below, I need ...
-1
votes
1
answer
65
views
If player is not holding the ladder then it should not jump twice
I am using Unity2d and I am stuck with a problem. I made the new layer for ground and ladder and added OverlapCircle and make double jump script for the player, so ...
3
votes
1
answer
191
views
8-way aiming in run 'n' gun
I am developing a 2D run 'n' gun game in Unity and am having an issue getting the aiming to "feel right".
Some background:
The player can aim in 6 directions when running (left, right, and ...
0
votes
1
answer
1k
views
How do I detect if my object is grounded?
I am trying to detect when an object is grounded.
My script right now is:
...
0
votes
4
answers
842
views
Sticking the Rigidbody2D player to a moving platform without parenting & transform fiddling
I have a player entity with Rigidbody2D component and I have a moving platform which is a kinematic Rigidbody2D. Player movement is done by setting it's velocity (...
0
votes
1
answer
177
views
Make enemy move diagonally in 2D
I'm making the enemy follow the player only straight or diagonally e.g.(1,1)(1,0)(0,1)(-1,1).
I expected the problem that I have, but I don't really know how to fix it. When my enemy is placed ...
0
votes
1
answer
28
views
When pressing both the key then releasing any1 key then the anination is not played
i give the running animation to the character and created a flip script...when press A then player move and flip to leff and animation is played ....when press D then player move and flip to write and ...
0
votes
1
answer
99
views
High-performance update of a bitmap grid
I need to visualize a fast paced process in .NET in 2D. I am planning to use writeable bitmap 800x40px.
The idea is like this - there are objects which are represented by very basic colours and sizes ...
1
vote
1
answer
116
views
How should I setup my sprites for 2D combat?
I was painting pixel sprites of a goblin (the enemies in the game). I first thought of making sprites of it for each different scenario:
facing camera, moving toward camera 1, moving toward camera 2,
...
0
votes
1
answer
197
views
How to perform a sliding collision between a square and a circle?
Please point me to the duplicate if this has been asked before. I couldn't find it.
Basically, I am creating a 2d top-down game where the player is represented by a circle, and the tiles are ...
0
votes
1
answer
18
views
Select box-shape grid between two positions on tilemap
I want to be able to click and hold on a certain point and mark it as startPosition.
Then, while the mouse is held down and moved, mark that second position as <...
0
votes
1
answer
111
views
Experiencing strange behavior in Unity when rotating a 2D GameObject according to the slope it is standing on
I am trying to rotate a square GameObject, so it appears to be standing perpendicular to the slope underneath it. However, when above a slope, the square constantly "spins"; it seems like ...
2
votes
3
answers
300
views
Place Buildings to represent village
I try to convert an array of Buildings into a representation of a small village. There are several different buildings in a village, like factories that are located on the outside of the village, ...
3
votes
2
answers
180
views
Why is my jump arc preview inaccurate?
I'm trying to draw an arc out of dots that previews a KinematicBody2D's trajectory after a jump but said preview always falls short of the body's actual jump and I cannot figure out why. Below is an ...
0
votes
1
answer
260
views
Select specific tile in Tilemap
I am following this video tutorial on how to implement drag-to-select behavior like in an RTS. The only difference is, I'm using a tilemap.
The selection area is a square which I can drag to make it ...
0
votes
1
answer
47
views
Rotating player around planet causes drift in gun aiming at mouse
I have a bug with the rotation of a gun object that follows the mouse position. It has issues when the parent object player rotates. Example:
The player has a gravity script to keep them aligned with ...
0
votes
1
answer
137
views
Making a 2D gun spin from recoil when it shoots
I am trying to clone the game "Flip the Gun" as an exercise.
Here is the behaviour I have so far.
And here is the code I am using:
...
0
votes
1
answer
33
views
Place tiles along a specific axis / direction
I want to be able to place tiles only in the direction I've started "drawing" them.
For an example, if I click and hold on tile at position (0,0), and ...
0
votes
1
answer
112
views
Normalize a rotation around the Z-axis (issue with GLM)
I'm trying to undo some transformations coming from an external tool*. I'm getting different results depending on subtle differences in the input and wondering how to convert to a rotation about the Z-...
0
votes
1
answer
44
views
How do I get my fish to face the right way?
I'm making this 2d collecting game in Unity where you collect fish. However I can't get them to face the direction they are going. I've asked on some Discords and got no answer. Thanks in advance.
...
0
votes
1
answer
1k
views
Resizing canvas to match screen size in Unity WebGL
I'm learning how to make a browser game with Unity. I have set up the screen display dimensions to 960 x 640 (I read that it's a safe resolution to use. Feel free to correct me). I created a Canvas ...
0
votes
1
answer
61
views
(Hitbox) OnTriggerEnter2D only work if enemy is moving
(UPTADE) I am developing a 2D Topdown Rpg Game. I have a problem with trigger colliders. I have button which make active an object and ı use it like Hitbox when i press button ı destroy enemy if it is ...
0
votes
1
answer
226
views
How to stop Players and Enemies from pushing each other
I am developing 2D Top-Down RPG game. I have script that makes my enemy follow the player, and when they touch the player, the player will start to lose HP.
Everything works well, but when they touch ...
1
vote
1
answer
30
views
Maintaining facing direction at the end of a movement
I want to make my 2D top-down walking animation stop and revert to the idle animation while continuing to face in the same direction as the previous movement.
For example, when I go up then stop, my ...
0
votes
0
answers
18
views
2d packing shapes in rooms
I'm not sure of the correct terms for this so having a hard time searching.
But I have a series of 2d top-down rooms made up of random grid sizes between say 5 and 10 on the x and y axis. Each room ...
3
votes
1
answer
156
views
My Earthbound-like Movement Script works in Unity Gameview, but runs differently in Gamebuild
First programming question I've ever made in my short journey. I'm trying to create a script which moves members of your party in a line behind you (think Chronotrigger or Earthbound). Here's a clip ...
0
votes
1
answer
522
views
Press and hold camera movement with mouse in new Input System?
I am transitioning to the new movement system and am having trouble figuring out how to move the camera when a mouse button is pressed and held.
Here's how I did it before:
...
0
votes
1
answer
236
views
How to apply Time.timeScale only to certain scripts?
I have a need to pause my game and the simplest and most clean way that I know of (other than completely designing my own time system) is by using ...
2
votes
1
answer
162
views
Predicting trajectory of Box2D physics body using both: linear dumping and gravity
I would like to calculate position of physics body after some time because of predicting shots trajectory in my game.
I found some great answer here where Iter Ator provides equation to calculate ...
2
votes
2
answers
671
views
Performance of many canvas drawImage calls is very slow
I'm developing a top-down 2D tile-based canvas game. I have a single sprite sheet of all my tiles, and then a JSON tile map array of where they're placed.
Previously I would render all the layers of ...
1
vote
0
answers
122
views
Corgi Engine - Character glitches with "jump" animation on top of a ladder
I'm new to Corgi Engine and Unity in general. I have an issue that I could find a way to resolve.
I'm using CorgiEngine's "RetroLadder" prefab and extended "Rectangle" character ...
0
votes
2
answers
533
views
"Update cannot be an iterator block" when trying to wait for jump to finish
As of now, I'm getting a C# error (CS1624) stating that:
The body of PlayerMovement.Update() cannot be an iterator block because void is not an iterator interface type.
The error is within the ...
0
votes
2
answers
83
views
Main Camera re-sizing in 2d
My UI :
An UI from YouTube video :
Look my camera's size is 10 and his camera's size is only 5. But, my camera's width is larger than height. If you look at scale (x,y,z)=(1,1,1). I tried to change ...
1
vote
1
answer
614
views
Is it possible to somehow change the collider points to match sprites during the animation in Unity?
Is it possible to somehow change the collider points to match sprites during the animation in Unity?
I am using the Unity built in animtion recording feature. I would like to change the points of some ...
1
vote
3
answers
2k
views
How to Make Border of 2D Game in Unity
I have a border by default. But, I'm having trouble detecting if my object collides with the border. I am looking for efficient ways to do this, and I am not sure what should I use. I thought using a <...
0
votes
1
answer
679
views
Character falls through the Platform Effector 2D in Unity. How can I fix it?
Character falls through the Platform Effector 2D in Unity. How can I fix it?
Here is the demonstration: https://imgur.com/G5YkTxa.
I tried changing the Edit - Project Settings... - Physics 2D - ...
2
votes
1
answer
449
views
How can I jump down from a platform in Unity?
How can I jump down from a platform in Unity?
I use two 2D colliders: one is my character, another one is platform. These colliders allow my character to stand on platform. Now whenever a characters ...
0
votes
1
answer
283
views
UNITY: How to LOAD save file from main menu
So I've created a simple main menu with a new game, load game, and quit game buttons. In the new scene where I've created pause menu save/load buttons work, I've created a new object and attached a ...
0
votes
1
answer
51
views
How to Change an Icon based on what Collider the Player Hits
So I have a 2D platform game where a player goes around collecting fruit but currently I only have one icon. Currently I use an image on a canvas to display the fruit image. How can I make the UI ...
0
votes
1
answer
488
views
Item counter unity
How is it possible that a create an item counter in unity?
My current Scripts -
Counter.cs
...
0
votes
0
answers
28
views
How to see the surface arc in Unity?
How to see the surface arc in Unity?
There is the tutorial and in this tutorial we can see the arc in editor:
While I can not see it. I checked that all my gizmos are enabled.
How can I enable the ...
1
vote
1
answer
103
views
2D shadow from polar coordinates has hard cut-off at a certain radius
I'm trying to cast shadows from a 1D texture that goes from white to back according to the distance given by an occlusion map. That part I think I got it right. The problem lies on the algorithm to ...
0
votes
1
answer
549
views
Looking for a game engine to make a game like "Ikariam" or "Ogame" [closed]
I'm an IT student and currently in my spare time I want to start a project. I would like to make a game that resembles a browser games like "Ikariam" or "OGame". I don't want this ...
0
votes
1
answer
284
views
Removing walls of a tilemap at runtime in unity
I've been trying to implement some light procedural generation into my game, nothing fancy. Just spawning rooms down in different areas in order to add some replayability. I watched a few videos and ...
-1
votes
2
answers
101
views
How do I fade between scenes when my player reaches a certain point
I have made a 2d Platformer but when my player reaches the end of a level I want it to fade to the next level.
How can I have multiple scenes that each have one level and that fade in and out?
Load ...
0
votes
0
answers
66
views
Make 2d sprite move in unity
At the moment I have a movement script which moves my player in Bothe directions but it only faces 1 way -
...
0
votes
0
answers
612
views
How can I make Enemy follow the player in unity
I have a 2d platform game where I want the enemy to follow the player for some time
Currently the enemy constantly follows the player -
...
0
votes
2
answers
771
views
In unity how can I make a checkpoint system
I have a 2D platformer and if my player dies, he goes back to the start, but I want there to be checkpoints.
My current Respawn script:
...
2
votes
2
answers
256
views
How to smoothly interpolate 2D camera with pan and zoom
I'm developing an animation application with a 2D virtual camera. The camera viewport can be positioned and scaled in the keyframes and is then interpolated to render the final animation from the ...