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
1answer
41 views

Deriving shadow position from a 2D heightmap

I have a 2D heightmap with discrete values. Based on these values they should cast a fixed position shadow (constant angle respective to the "sun"). I can figure out how to cast it on a flat ...
0
votes
2answers
36 views

How to make windows that pick up what appears in the other

Basically there are 2 windows that you can drag and drop around the screen. Whatever appears in one window will also appear in the other. The two windows cannot go one over the other. This is a demo ...
1
vote
1answer
57 views

Cannot properly get 2D top-down tile-based collisions

I am using HTML, CSS, and plain JavaScript for a 2D top-down tile-based simulation. I am trying to do collisions in which, for example, if I move up and hit the ceiling collision tile, I cannot ...
0
votes
0answers
13 views

Struggling to get layer collision to work without stopping movement

I currently have my player object set with a dynamic rigidbody and a box collider, and the object I want it to collide with just has a box collider. The player is on the Player layer, and the object ...
0
votes
1answer
25 views

Does the Z axis matter at all in a 2D project, when using layer collision for all collision detection?

As I understand it, the Z axis is responsible for the rendering position of the object in relation to the camera/other objects, and layer collision only checks if an object collides based on the x/y ...
-1
votes
1answer
38 views

How Can I Order The Scores List By Newest Added? Unity C#

I have 5 scripts to make the scoreboard. But I don't know how to order the list (the scores which are stores in a list) by newest added. Can someone please help me? Thanks :) First Script: ...
4
votes
2answers
82 views

2D topdown generating stairs (access) to generated hill

I'm doing 2d topdown procedurally generated world. I'm generating perlin height values, and when certain value is crossed I'm generating one level higher, while edging biomes creates cliff of the ...
1
vote
1answer
45 views

Having trouble implementing edge collapse operation with half-edge data structure

I'm trying to make a half-edge data structure to interact with meshes in 2D space in Unity but I'm having trouble with implementing an edge collapse operation that merges one vertex into its twin half-...
0
votes
0answers
18 views

What is the most efficient way to keep a vertex contained within a network of edges/vertices?

Given this picture, I want to move or displace the red vertex but I don't want it to pass the orange edge boundaries or the blue vertices. I either want to stop the red vertex when it gets close ...
-2
votes
0answers
18 views

when I type "void On-Collision" in VS code it is not being completed like any other command. what should I do?

'Ninja.OnCollisionEnter2D(Collision2D)' must declare a body because it is not marked abstract, extern, or partial [Assembly-CSharp]
0
votes
0answers
28 views

How would I determine the size / camera bounds of a staggered isometric map?

I am currently making an isometric 2D game, and the map grid is of the staggered-isometric type. I want to attempt to create the camera so that it stops at the end of the map bounds. Now I am fully ...
1
vote
1answer
42 views

Only Square Textures loading correctly (Beginner question)

(Sorry if this has already been asked, I couldn't find any other question or source describing my problem) Okay so basically Square textures load and display just fine. But for some reason, when ...
2
votes
1answer
547 views

Spritesheet with unstable width

I'm working on my 2d game engine using HTML5 and Canvas. I have a sprite sheet, and each frame of this sprite sheet has its own size. Considering that the Viewport is following this sprite sheet (in ...
-4
votes
1answer
50 views

Can anyone explain this code? C# Unity [closed]

Can someone explain this code to me? ...
0
votes
1answer
46 views

Determine when a character is stationary, and which direction they are facing

I'm currently trying to figure out two things for my character's movement and animation. A better/faster way to track when movement stops than the IsSleeping method. A way to track which direction my ...
0
votes
1answer
19 views

How to make a sprite face the mouse while remaining upright, without negative scale?

In the game I'm creating I have a sprite that needs to constantly be facing the mouse, but the sprite also always needs to be facing "up". Because of the Polygon Collider 2D and Shadow ...
3
votes
1answer
83 views

I want to cut a pizza slice out of a 2D circle using mouse input in Unity. What data structures and geometric formulas would be best for this?

I understand this is probably not an easy task considering I haven't found any code examples online that do something like this but if I wanted to take in mouse input lets say during a drag and use ...
0
votes
1answer
67 views

Pixelart loses quality when rotated in unity

Sorry, still fairly new to the game here but my pixel art gets little ridges on it when I rotate it in unity. I'd like the pixels to rotate all together. Is this just because I need to make my pixels &...
0
votes
0answers
41 views

How do I cut mesh partially with EzySlice?

I'm using the EzySlice framework to cut meshes (https://github.com/DavidArayan/ezy-slice). So far it can cut a mesh but infinitely but I want to be able to cut partially like this: As you see in the ...
-1
votes
1answer
33 views

Overshooting when traversing between two points with a set velocity

I'm creating a prototype for something I may make into a game and I've run into difficulty in creating a method to move a ship along a line between two points. While it reaches the end point, it ...
0
votes
1answer
68 views

Find those points lying on a circle from a ton of points

Given a 2d scene and 10,000 players with coordinates in the scene, I want to implement a function, the input is a circle with the center coords and its radius, the output is those players that lie on ...
0
votes
0answers
19 views

custom 2D skeletal animation

I'd like to animate my 2D player by interpolating him between keyframes of joints/bones. He's to be very simple, just a chunky stickman outline of coordinates with no sprites. I want to make it all ...
0
votes
2answers
68 views

Shooting from Gun in LibGDX

I'm trying to shoot a bullet from the tip of a gun. This gun is a Sprite object and it is constantly being rotated to point towards the mouse. The issue is that the point to shoot the bullet from is ...
0
votes
1answer
60 views

How do I make an object bounce off the wall?

I am spawning objects at a random place at the top of the screen, tilted at a random angle like this: ...
0
votes
1answer
35 views

How to recreate a comic book panel transition with my canvas (simple 2D background art)?

https://www.youtube.com/watch?v=Tqqf5Y8LyR8&t=23s&ab_channel=ErikLoyer So I want to achieve a transition like from the above video, specifically at 0:23 the TRACK, but there is a 3 Dimensional ...
0
votes
0answers
36 views

match-3 Board border

I'm new to unity and I'm currently working on a match-3 game. I know there are a lot of similar games and that's why I would like to know what is the best way to autogenerate border of a match-3 board ...
1
vote
1answer
98 views

How do I carve rooms and corridors into my map to connect exits placed at the edges?

I'm creating an adventure/RPG top down game where the map is randomly generated divided into zones. A major problem I'm having trouble figuring out is creating exits placed at the edges. The game is ...
-1
votes
1answer
51 views

How to make environment art like the building interiors in Digimon World 3 [closed]

I'm wondering how to create art like this (the map, not the characters), is this 2D or 3D?
0
votes
0answers
69 views

why is my grappling hook pushing me when i flip the character in godot

When i flip the character and use the grappling hook it pushes me away from the grappling hook and not toward. player.gd ...
1
vote
1answer
19 views

Odd behaviour when changing rigid body velocity inside OnCollisionEnter2D

This is the code I'm using to make an object bounce across the scene: ...
2
votes
2answers
167 views

How to use different drag values for the X and Y axes on a Rigidbody2D?

I'm building a small 2D character controller using Unity physics to simulate an oldschool platformer. I know this is not the best way to do it and I have my own version using just raycast and custom ...
0
votes
0answers
24 views

2D Top Down Follow Camera Stuttering

I am making a top down pixel art game and am using a simple follow script for my camera. ...
0
votes
2answers
69 views

Help with multiple powerup types

I am trying to have a single class that handles multiple powerups types and using enum for the types of power-ups and switching the powers based on enum however when there are multiple power-ups in ...
0
votes
1answer
54 views

How to perform 2D vector graphics operations in Unity

I am currently working on a game that is drawn completely by 2d vector graphics operations like e.g. drawRoundedRectangle drawPolygon fillRect withBlur How can I perform such vector graphics ...
-1
votes
1answer
66 views

Unity 2D - Raycast not colliding with collider in very specific circumstances [duplicate]

I've been trying to work out what could be causing this bug for days now but can't figure it out for the life of me. I'm trying to make a fish avoid the walls of it's tank in a Unity game I'm creating ...
0
votes
1answer
19 views

how to add overall collider to a bunch of circles or boxes?

I have 3 circles (2D) they all have circleCollider2D. what I want is to make a collider that make border around them. I can't express which type of collider I need, so I put example image below. Red ...
0
votes
1answer
30 views

Prevent Player from Moving During Jump

I am new to Unity, and am trying to make a simple 2D platformer from this video, and I am trying to modify it to prevent the player from being able to switch directions during a jump. Right now, you ...
1
vote
0answers
42 views

Object stuck against an obstacle still pushes other objects away

I have an object pinned against the ground by a revolute joint. A motor on the joint makes the object spin. Sometimes the object becomes stuck pushing against a static body. When it happens the object ...
0
votes
0answers
27 views

Having problems with mouse drag mesh vertex deformation in 2D

This is in 2D space. I want to create a mouse dragging mechanic like the one shown in the picture where I find a range of vertices relative to the position I first clicked where the red vertices have ...
1
vote
1answer
73 views

Generating consistent terrain chunks with unpredictable per-chunk seeds

I am working on an automatically generated (theoretically) infinite 2D world. The grid would be separated in chunks made of thousands of world tiles. We plan to use a Perlin noise function to generate ...
0
votes
1answer
19 views

How can I make a button active when all the items of my array have been displayed? (for a dialogue scene)

I've coded something in Unity using C# (see below) for a dialogue scene separate from the actual game. On the click of a button from the game, the player is taken to this dialogue scene where the ...
1
vote
1answer
39 views

How to prevent GameObject from moving?

I am making a pong game and here's the problem. The ball hits the enemy paddle and instead of reflecting the ball just takes the paddle with it. Ball Brains - ...
0
votes
0answers
17 views

Help with arrowmechanism

...
1
vote
2answers
91 views

How to blend a 2D terrain

Rimworld (shown above) has many different terrain types. In order to achieve Rimworld styled terrain, I need to achieve two goals A) How to render differently textured terrains B) How to blend these ...
0
votes
0answers
26 views

Using UI buttons for Input Manager

My character is supposed to be moved by 4-directional joystick. Until today I was using basic Input Manager for handling this from keyboard. I mean Horizontal and Vertical Axis. How can I make it so ...
0
votes
1answer
39 views

How do I find the correct vectors perpendicular to a vector in between two vertices?

I'm trying to push the purple vertices inward by moving it with a vector perpendicular to the red vector shown in the picture. Each directional vector created will move its respective vertex towards ...
2
votes
1answer
59 views

Detecting Surrounding GameObjects

Some Background Context: So I have a 2D prototype in Unity I am working on that has enemy entities that have rigidbody2D component set as dynamic as I am using physics (...
0
votes
0answers
35 views

Why my output image is not seamless?

I offset a region of an image but when I tried to restore it using same method it doesn't look right. here is my input and output: And this is the code I used to restore : ...
0
votes
1answer
69 views

Find Largest Room in 2d World

I'm currently working on a generated(Perlin Noise) 2D Cave System with Unity. The Caves currently look like this: What I want to do is spawn the Player (and other stuff) in the big Part of the Cave ...
0
votes
1answer
56 views

How do I make my obstacles (separate prefabs) appear randomly in the world?

I am using Unity in C# to code a game similar to Google's Dinosaur Run where random obstacles are spawned in the player's path which they need to jump to dodge. I have 6 different prefabs (with ...

1
2 3 4 5
66