Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [2d]

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

1
vote
1answer
15 views

Unity tilemap collider not colliding with rigidbody

In the wireframe you can see the tilemap collider for this hill. The red circle falls right through however. The circle has a 2D rigidbody attached. Everything is on the Default sorting layer and on ...
0
votes
0answers
21 views

Phaser 3: How to assign sprite to proper position

I have been building a game in Phaser 3. When I create a sprite using the Matter physics engine at a specific position, the sprite does not appear at the specified position. Depending on the ...
0
votes
1answer
31 views

2d Rectangle Collision Resolution: Find rollback point

I have a 2-part question: 1: I have 2 rectangles, A and B. B is a wall and A is moving. My simple logic here is every time A moves, it moves based on some (x,y) offset and then checks if it collided ...
0
votes
0answers
52 views

Adding 2D versions of real cars in a game can be a legal issue? [duplicate]

I've been thinking in doing a car game, but i wanted to add "real" cars into the game. Are 2D renditions of the cars with sprites/vector 2d graphics fine?
1
vote
0answers
11 views

Is there an established way to create a 2D XY NavMesh in Unity?

Specifically, one in the empty space between colliders, rather than on an XZ plane (more or less) over the surface of a collider? Specifically this is because I have a drone, in a current project, ...
1
vote
0answers
43 views

2D Map Chunks - Individual Files?

I have a 2D map of 500 x 500 tiles, split into chunks of 256 x 256. I'm saving each chunk as a separate file, and I have them loading in as the player moves around. This means however there's over ...
1
vote
1answer
17 views

Instantiating a GameObject at my desired position not working

I'm sure I am misunderstanding something about Unity vectors or something here. I am brand, brand new to Unity so this is part of the problem. I am trying to make a simple atomic model and I am ...
1
vote
0answers
45 views

Getting the Closet Points between Polygons with the GJK Algorithm

I am trying to implement the GJK algorithm by following this lecture. For the most part, it is working, but sometimes 1 of the 2 closest points is incorrect. Here are two examples: EXAMPLE 1: The ...
2
votes
1answer
49 views

How do I render a cylindrical world space onto a flat, 2D view port in Unity?

The question is just a logical extension of this question. So, how should I render a cylindrical world space onto a flat, 2D view port in Unity? Thank you.
0
votes
0answers
10 views

Android SurfaceView - What is the correct approach for Game Object implementing OnTouchEvent?

I am developing a game just for learning. I have a GameView class extending SurfaceView, and a Scene which extends GameView (for evey scene in the game). Each Scene object has a ArrayList variable. I ...
0
votes
0answers
20 views

Drawing simple shapes in OpenGL ES 1.1

I'm having an issue getting OpenGL ES 1.1 to draw anything. All I get is a black screen every time. I have the following working OpenGL 2.1 code, which I'm trying to change over: ...
3
votes
1answer
81 views

Wraparound world with wraparound horizontally physics implementation in Unity

What is the best way to implement a wraparound world with wraparound horizontally physics in Unity? That means that if I have an object and move it so that a part of it sticks off to right (so that ...
0
votes
0answers
30 views

How to implement a “Parent Constraint” in a custom 2D rigid body physics engine

So I am trying to write my own physics engine, with a specific game in mind, these are some design considerations: the game is about spaceships, the players build their own ships and find others in ...
0
votes
1answer
22 views

How to determine what direction an object should orbit around another

I am creating a game in Unity with 2D. When a button is clicked a static object is attaching a hinge joint to a dynamic object, so the dynamic object orbits it. When the dynamic object gets attached, ...
0
votes
0answers
18 views

Scrolling backgrounds without tiles

I'm writing a paper on game backgrounds and need to look at how they are implemented in different games, but I'm a bit stuck on scrolling backgrounds. While it's easy to recognize a scrolling ...
3
votes
1answer
42 views

Any tips for aligning existing sprite sheets to a grid?

I've been dabbling with sprites, and I've found most sprite sheets that have been posted for existing games (for example, Sonic & Knuckles) are not aligned to a grid. I've found this frustrating ...
0
votes
2answers
48 views

Unity prefab from multiple sprites

I am making a prefab of a simple building by combining sprites. As you can see in the Hierarchy view, this simple building is composed of very many gameobjects which I created via dragging sprites ...
0
votes
0answers
23 views

How simulate day/night transition on 2d game? [duplicate]

I'm trying to create a 2d game and I want to have a day/night transition, but i'm actually new on Unity and I don't know how to do it, I'm using this code, but give me error and I really don't even ...
0
votes
0answers
9 views

Unity - Rotating image on button made button un-useable [duplicate]

I recently started trying to teach myself Unity2D development using some tutorials and something weird was happening last night while I was working on my project. Basically I have an image that ...
0
votes
1answer
35 views

Scale camera to fit screen size unity

My background and gameobjects are 2d sprites not UI images ,I want to know how to make my background scale with screen size and positions of 2d sprits on it don't change after building game (webGl) ...
0
votes
1answer
44 views

Object coming from far away effect in 2D

I have a path made using segments of sine wave interpolation put together that is drawn flat on the screen. And I would like to give the path the effect of coming towards the player. I tried to draw ...
2
votes
1answer
92 views

How do force fields scale?

Setting I am designing a 2d game in which a \$1/r^2\$ force acts between moving charged particles, and the number \$n\$ of particles is very large. To calculate the force between all pairs of ...
2
votes
0answers
60 views

Trying to get Vertexshader to work Monogame 2D

If I don't use the vertex shader, it gives me white textures which is what the default color is. Once I add the vertex shader, the screen is black. I figure it is something wrong with the Matrices I ...
0
votes
0answers
37 views

Ice transition particle effect

We are small indie team developing a casual mobile game. We are trying to implement an effect like the normal-to-ice block transition in Angry Birds 2: How can we implement an effect like this in ...
0
votes
0answers
60 views

Stop Animated Tile from looping Unity2D C#

I am using the animated Tile script and starting the animation when I need it, by replacing a static tile with an animated one. Currently on collision with the player, however, I need the animation to ...
1
vote
1answer
130 views

2D snake game ( how to rotate snake's head with movement ?)

I want to know: how to rotate snake's head with movement how to make tail prefabs (body) follows head direction. ...
0
votes
1answer
19 views

I can't find a way to make my projectile gameobject collide with my ofscreen collider

so my code on my collider is as followed public class Collide : MonoBehaviour { ...
0
votes
2answers
55 views

Modern Techniques of Drawing Pixels?

How do game engines efficiently handle and draw pixels within a given display? As a personal project / exercise, I had begun developing a simple game engine written in Java, but came across the issue ...
0
votes
0answers
34 views

Problem with Unity 2d(infinte Jump)

I'm doing a 2D videogamesin Unity, I´m a beginner so I don't know really well how to program in C#. The problem is that I want to have just one jump, but my player a infinite jump. Thanks :) ...
0
votes
1answer
32 views

2D Rotation of an object along a curve line

I would like to rotate an object along a curve. I managed to move the object along the curve using bezier curve algorithm. The hard part is to rotate the object constantly(no limit on maximum angle), ...
1
vote
1answer
53 views

Can't get AABB Collision to work properly

This is the code I'm using to resolve collisions on the players left side. It works when I'm on the ground, but if I'm falling, it does not work. ...
1
vote
1answer
73 views

How to make the player's weight deform a rope bridge?

I'm making a 2d game, and I want my character to deform my rope bridge with physics effects on the jointed structure when they walk over it. Right now, the player can stand on the bridge, but it ...
2
votes
2answers
120 views

How to program smooth player 2D movements

I am writing a simple 2D game in Rust, having access to the following dependencies: Piston: for the graphic engine nphysics: for the physics engine The genre is Metroidvania, the game features a ...
0
votes
1answer
35 views

Unity - how to check if object is fully covered by another objects (2d)

I am creating an educational game for kids , and in one of the levels player must to paint animals , like in color book, so I created scene where 2 object , already colorful lion and white lion (white ...
0
votes
1answer
24 views

360 degree Shooting using Pythagoras problem Unity 2D C#

I have used pythagoras to give the bullet a velocity in the bullet class. Velocity is applied when Instantiated(); ...
0
votes
0answers
28 views

How can I prevent movement from analog joystick “bounce”?

I'm working on a top-down game where the player can move up/down/left/right. The sprite changes to the corresponding direction, and I have an internal value that tracks the direction the player is ...
0
votes
1answer
43 views

Unity create Animated Tilemap?

Im trying to create an Animated Waterfall Tilemap from a tutorial video. In his video when the author right clicks he can see a Animated Tile > under CREATE option. But In my case its not there !! ...
0
votes
0answers
42 views

How to get one KinematicBody2D to push another?

I am working in Godot 3, where my player is a KinematicBody2D. When I collide with a block which is also a KinematicBody2D I'd ...
0
votes
1answer
22 views

Changing Hitbox from a single spritesheet

I have different animation in a single spritesheet. I wonder how do you guys assigning these hitboxes?
1
vote
0answers
67 views

“Proper” way to do 2d scrolling game

I am new to game development and I would like to make a 2D scrolling game with a tile based engine. If you want an idea, it should resemble the Legend of Zelda: A Link to the Past like in the image: ...
1
vote
1answer
36 views

Why only few parts of the 2D sprite change their colour when I apply sprite color in Unity?

I'm making a stickman 2D game where I have different sprites for the player. But when I try to change the Sprite Renderer Color, it only changes few pixels of the sprite and the rest stays black as ...
1
vote
1answer
37 views

Does it make sense to export and use skeletal animation as sprites?

As tools like Dragonbones, Spine lets you export animations as both sprite atlas and skeleton data (JSON/binary), I'm not sure which format to use when importing to Unity. I have few concerns: Will ...
0
votes
3answers
71 views

How to add collision to this script in Unity

I Want to be able to have collision were my player can't go through objects with colliders un Unity but I don't know how to make that happen, can you please help? ...
0
votes
2answers
50 views

Keep platformer jump height consistent with different frame rates

I want to achieve a platformer jump similar to that of Super Mario Bros. (keep pressed the jump button to jump higher) and I want it to be frame rate independent. At 30 FPS it works as I want. However,...
1
vote
1answer
80 views

2d side scroller slope physics and collisions

In old 2d games such as double dragon, streets of rage etc. where the player could move “up and down” on the y-axis to give an illusion of depth (as opposed to something like Mario) how were slopes ...
6
votes
1answer
215 views

How do I store destructible terrain that characters can walk on?

I'm trying to make a 2d game like Worms (in JS, if it's important). I found 2 possible ways of implementing destructible terrain: Bitmap. Store every pixel in a huge 2-dimensional array Represent the ...
0
votes
2answers
122 views

2D character movement

My character moves right and left correctly, I want to know if it is possible to move character forward and backward to collect hearts (I know that in 2d no z axis I want to know if it is possible ...
2
votes
4answers
62 views

How to smoothly move camera when the player is climbing a diagonal staircase in 2D tile-based side-scroller?

I am working on a game, which is tile-based, similar to the way Terraria works. My player is 2 x 3 and can move over one-high obstacles, but this creates a very jittery effect, since my camera ...
0
votes
2answers
48 views

How To Destroy/Deactivate one enemy without affecting other enemies of the same type?

In my game, you jump on zombies'heads to squash them. Currently I'm only able to have one zombie in my game. When I add another (duplicate or drag from prefab), then run the game, I can squash one ...
0
votes
2answers
113 views

Game assets are images or 3D models

I am new to game development and I have created simple games with javascript and SFML. Those games are 2D and there I used images as my gaming assets. I was trying to be familiar with OpenGL like 3D ...