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
0 answers
12 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: ...
2 votes
1 answer
957 views

When setting Rigidbody.isKinematic true collider won't work anymore

I have a rigged 2D character and used Collider2D/Rigidbody2D/HingeJoint2D to body parts to implement ragdoll. It works fine, but I needed to run ragdoll physics only when character is dead. So I made ...
0 votes
1 answer
56 views

How to spawn card sprite

I have a card sprite that I would like to spawn at a specific transform position but can't get anything to appear My Code - ...
1 vote
2 answers
1k views

How can I add an animation to tile swapping on a tilemap?

I am beginner in Unity and I have created tilemap using new tilemap system in unity which looks like this: I created a script that lets me swap tiles. First I click on some tile and than I choose ...
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
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
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
55 views

Tilemap is rendering all tiles as black squares

I'm trying to render a 2D tile map. I've placed a Tilemap object in the scene from the create 2D object context menu, set a reference to it to one of my script ...
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
1 answer
1k views

Is there a way to make the enemy start its pathfinding once the player is in a certain distance than the enemy

I am currently using A stars' pathfinding code here: https://arongranberg.com/astar/. So I didn't create any scripts, and used the scripts provided by astar. But the problem here is that even though ...
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. ...
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 ...
0 votes
3 answers
6k views

Gyroscope Parallax Effect In Unity

I want to make a parallax effect in Unity 3D with gyroscope like the one on this site: http://matthew.wagerfield.com/parallax/ I found an asset, but it is too expensive. So I need a script which I ...
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 ...
1 vote
1 answer
58 views

Could use some help figuring out bouncy physics material in this PhotonEngine game

So I'm trying to prototype a primitive 1v1 fighting game where the goal is to push the opponent off of the platform rather than actually fight. This is working great in a local multiplayer setup using ...
3 votes
1 answer
1k views

Character creation using spritesheets

I am currently creating a 2D fighting game and have implemented a system where upon starting a new game, the player is presented with the option to create a custom character. I have a set of string ...
3 votes
3 answers
1k views

2D Ragdoll - should it collide with itself?

I'm working on a ragdoll fighting game as a hobby project, but I have one dilemma. I am not sure if my ragdoll should collide with itself or not, i.e. if ragdoll's body parts should collide. 2D ...
1 vote
1 answer
652 views

What are the basic equations in 2D physics collisions?

I'm making a 2D fighter, and I have gotten a basic engine, but right now I need to add the collisions, but I'm sure a basic AABB check will not be enough. I'm sure it needs some basic 2D physics ...
4 votes
2 answers
515 views

What should I use as units for my 2D game?

I'm trying to create my first C++ 2D fighting game from scratch, using SDL, and so far I got things to where I am able to move a couple sprites around using some keyboard keys. Right now, I have it so ...
6 votes
1 answer
1k views

How can I handle fighting game collisions for complex animations?

Imagine that I have an animation like this. As you can see, this attack hits in three horizontal places. The opponent facing this player could be hit mid and low (standing or crouching). The same ...
1 vote
1 answer
5k views

How do I program attacks and combos in a fighting game?

I'm working on a game a bit like "Super Smash Bros.", using C++ and SFML. I can't figure out a good way to program attacks. First, I coded individual functions for each attack. The problem with this ...
15 votes
6 answers
5k views

Creating a seamlessly looping 2D multiplayer level?

A discussion came up recently about how to create a 2D side-scrolling multiplayer game that can have an looping level design (Think of Starbound and how their worlds are looping). I thought the ...
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
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 ...
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 ...
0 votes
2 answers
341 views

How to calculate the post Rigidbody2D velocity vector before applying a specific force in Unity?

I am trying to implement a space rocket in 2D. Whenever the player presses a button, a constant force (Both vertical and horizontal) is being added to that rocket. What I want to add is a maximum ...
0 votes
1 answer
107 views

Moving object parallel to another on path on 2d space

How to Move object parallel to another on curved path on 2d space
2 votes
1 answer
4k views

Change color, or material of specific line segments on Line Renderer

We're making a game that plays with a LineRenderer, and we want to give it a different visual feedback relative to the side of the screen that it's on. We want to change the feedback of the specific ...
2 votes
1 answer
75 views

How do I get the consistent time it would take for two points to reach each other in circular motion?

I'm making a 2D game. It involves the player swinging around a grapple hook in perfect circular motion, however, I want to make the cooldown for this ability based on predicted end position for the ...
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 ...
-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 "...
0 votes
2 answers
126 views

Converting from global coordinates to local coordinates

I am trying to create a Radar/Minimap for the F1 2021 game in C#/WPF. Here is a image of what I am trying to replicate In the image, the white car (my car) will always face the direction it is going. ...
0 votes
4 answers
5k views

Line of sight on a 2d grid

I've been looking for similar questions here and on google, but none have worked for me yet. I have a game, where I have a 2d array of square tiles (they're objects with accessible x and y pixel ...
0 votes
2 answers
197 views

Rigidbody not working properly

I have two objects: a player and a wall. The player is passing through the long side of the wall but it collided with the short side of the wall. I want the player to collide with whole wall. Here is ...
0 votes
1 answer
917 views

Stop 2D platformer character from sliding down slope

I'm making a 2D platformer game with the default Unity 2D physics. I am implementing slopes, but my player slips down the slope because of the physics. Here is the code I use for the player movement: ...
0 votes
1 answer
74 views

Scrolling the map in a 2D a tiled game

I am making a small game where I store information about the world around the player (like tiles) using a small 2d array of integers. In the game you can scroll the screen to the left or right. I also ...
9 votes
2 answers
11k views

More efficient way to implement Line of sight on a 2d grid with ray casting?

Consider a 2d grid of tiles, and an approximated sphere of coordinates - centered on the player - that represents line of sight. The goal is to block the line of sight beyond obstacles (ie walls). It'...
1 vote
1 answer
903 views

Pathing for 2D, sprite-based game

I'm making a 2D, oblique-styled sprite based RPG. My game does not live in a 2D matrix (like Tetris), rather it's sprites animating over a tilemap. I am trying to set pathing rules for NPCs. I've ...
0 votes
1 answer
65 views

Stretch line on bow using touch

I have drawn a line on sprite representing the string of a bow. I want to stretch it with finger touch input, using onTouch. I have added a Physics body but I don't ...
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
159 views

High CPU usage with Godot tilemap

I am using Godot as my game engine and I am making a basic 2D game, I have a small map with 1 Player and 5 Enemies walking around in it. The game includes some basic code for walking and shooting at ...
1 vote
1 answer
74 views

Control how quickly 2D vehicle straightens out

I'm implementing vehicle movement in a 2D environment, where a vehicle consists of a front and a back "axle", both represented as 2D points. When the front axle moves, the back axle should ...
4 votes
1 answer
966 views

How to handle forward/backward movement in an oblique top-down view

I'm making a pseudo-2D top-down game, where my assets are actually 3d but I use an orthographic projection to introduce more depth. I saw a picture of how the game "Enter the Gungeon" was actually ...
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
1 answer
52 views

Contact friction for overlapping rectangles

I am currently developing a top-down "tabletop simulator" where you are able to drag, drop and rotate playing cards on a table. The cards are able to overlap but do not interact as of yet. ...
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

Trying to move the snake smoothly in a 2D game

...
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 ...
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
2 3 4 5
67