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
0answers
11 views

Moving my character/camera makes environnement jerky

I'm learning to make a Tilebased game with Unity and for that I use the Zelda alttp assets. I just have Tiles, a Camera and a moving Character with a rigidbody2D and a CircleCollider. When the Camera ...
0
votes
2answers
19 views

Unity 2D Tiles disappearing when i zoom in

All my tiles/sprites have 0 as their position on the Z axis, except my main cam which has -10. For some reason i suddenly couldn't zoom in without everything disappearing, I switched to 3D view to ...
0
votes
0answers
21 views

Implementing counter-steering for a drifting car in 2D

I could make a sliding car. but i want the counter steer functionality. My current model of the car has 4 wheels, all of them have a script handling the slip. am currently multiplying the side ways ...
-1
votes
0answers
32 views

How to slowly rotate a graphic over time as it moves toward target?

This is the code I am working with. I feel like I am close, but I can't stop the graphic from turning. How do I stop the graphic from spinning continually? ...
0
votes
1answer
13 views

Unity BoxCollider2D causes motion to be exponentially multiplied

I have a player and an enemy square for my 2D game (technically it's a cube, but it's rendered as a 2D character). I have a RigidBody2D attached to the player and the enemy each, along with a ...
0
votes
0answers
40 views

2D Spatial Hashing in C++ Causing Game to run more Slowly

I'm trying to use spatial hashing to speed up collision detection in my game. I believe spatial hashing is better suited for my game than quadtrees, because I have lots of fast-moving objects in my ...
0
votes
1answer
40 views

Unity tilemap tiles animation

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
0answers
29 views

Layering Animation on Pixel Art Sprites

I'm currently having some trouble finding the best way to layer animation onto a 2D pixel art sprite animation. For example, I want to add various expressions and blinking onto a pixel art idle ...
0
votes
0answers
42 views

2D Terrain Modification/Expansion?

I have a problem which I don't really know what to call, and I would like to apologize in advance for perhaps the misleading title. Let's say I break a few objects in the 2D game and they scatter ...
0
votes
0answers
21 views

pushing rigidbody with force to match mouse position [duplicate]

i'm making a game in which the player character, a 2d rigidbody, is controlled by the user's mouse dragging them. i originally made it so that the player character's position was made the same as the ...
0
votes
1answer
38 views

2D line of sight - hiding all tiles behind walls

I'm interested in knowing the techniques on how 2D games hide tiles that are behind walls. This is a really old MMO that is probably the easiest example to show what I'm asking. Here you can see ...
0
votes
1answer
50 views

How is actual object size in a scene calculated?

I've got stuck with 'pixel per unit' parameters and object scale. I've created two different sprites. A background picture, 1000x1000 pixels, and another one for a 'player', 200x200 pixels. I've ...
1
vote
1answer
21 views

Rotate a 2D object slowly to the touch position in Unity

I am creating a circular Joystick like setup in Unity. Played a lot with it in different ways but I don't get the desired results. ...
0
votes
1answer
39 views

2D party follow the leader in Unity?

I am attempting to make a 2d side-scrolling platformer where the player collects other characters as they advance through the levels, like you would in a classic top down rpg. However, I am having a ...
1
vote
1answer
39 views

2D Collision detection: rewinding to moment of first intersection

I am working on a collision system in a Platformer tile-based game. All tiles are AABB. I am trying to implement "Rewind to Moment of First Intersection" mentioned in this post's second point. The ...
0
votes
0answers
23 views

How do I get the objects in my pixel art game to have a more “top down” (orthogonal dimetric) perspective such as “A Link to the Past” or “Sparklite”?

I'm creating a "top down" pixel art game with with my friend's and we're basing it off of famous games like ""A Link to the Past" and "Sparklite". However, we're having problems with perspective. So ...
0
votes
0answers
18 views

How can I spawn and drag 2d object from a Canvas button?

I want to create and drag an object from canvas button to scene. How can I do this?
1
vote
1answer
44 views

Unexpected behavior of bodies affected by gravity in 2D

I have a simple code that calculates the acceleration of a body every update of my simulation using the Newton's law of universal gravitation and the second law of motion. ...
0
votes
1answer
46 views

Blend different biomes using linear interpolation

I've been scouring the internet for hours looking for a solution to blending biomes that have different amplitudes and frequencies together to create a seamless world. A recurring theme I'm seeing is ...
0
votes
1answer
51 views

How can I keep track of which “rooms” characters and NPCs are in?

I have a Unity 2D project which has a player character and numerous NPCs all potentially moving (top-down) at the same time during play. The number of NPCs is not to exceed 100 (and will be, probably, ...
1
vote
2answers
94 views

How to use an array of y values to render a 2D top-down Java game?

I'm fairly new to the world of coding, and there's probably a simple solution here. I made this array (the actual one is more complex since it includes everything I have so far) for the y values of ...
1
vote
2answers
103 views

What is the proper way of handling resolution and size units on a 2D game?

So I started to learn SDL2 and I want to make a simple 2D game. Now when I render a texture I have to specify in pixels the size of the element I want to draw and also the position in pixels on the ...
0
votes
0answers
6 views

Centre coordinate of 2D shapes in Pythonista

I am creating 2D shapes defined by paths in Pythonista with the Scenes module, for example a filled arc (pie slice) or trapezium What I find is that rather than being anchored by the point (0,0) ...
1
vote
0answers
28 views

HDR mode in windows makes build version of Unity game look washed out

I've got a 2D Unity game I've been working on. The development computer is hooked up to a TV that supports HDR. If I turn on the "Play HDR Games and Apps" switch in windows then run the build version ...
0
votes
1answer
44 views

Disabled script works anyway

I have a simple code that will be enabled when I kick, so I disable it right away but even though it is disabled, it works somehow. can it be because of his parent or something else I dont know of? <...
1
vote
0answers
43 views

Can I use trilinear filtering for my sprites, but keep their outlines unfiltered?

Suppose that I have two images of equal size. They both contain a square: https://i.stack.imgur.com/BI62X.png https://i.stack.imgur.com/Nev5Z.png When overlapped, both squares will appear next to ...
-1
votes
2answers
61 views

How to figure out that I'm onto ice tile?

It might be very silly question but serfing for two hours still can't find an answer. I'm trying to replicate battle city. I've made level with TileMap. But can't figure out how to know that my tank ...
0
votes
1answer
86 views

How can I move my player on exact x and y coordinates, like on a grid?

I'd like to implement movement exactly like it is done in this game. (You can see it in action on YouTube.) I need my Player to always stay in the center of X and Y similar to grid movement, but with ...
0
votes
1answer
46 views

Proper 2D isometric tile depth sorting?

I'm using Raylib, and I'm attempting to place tiles on a level, and the algorithm for placing the tiles is working. The problem is that the player will display over the walls on the bottom right hand ...
0
votes
0answers
18 views

Preserving original direction when collision changes direction

I have sliding for player characters and it's working, but running into a small issue. The original direction gets lost, and I'm unable to resume the original direction. My characters have a ...
0
votes
1answer
67 views

Emulating 3d trajectory in top-down 2d game?

As the title suggests, I am wondering if it's possible to emulate a 3d arrow trajectory to a top-down 2d game? If you would look at this clip of Age of Empires 2 game, especially when archers are ...
0
votes
0answers
51 views

How can I get my entire game to scale based on screensize?

I'm currently building a 2d mobile game and I'm currently stuck trying to get my game to scale with screen sizes. Currently my background is scaled to 1920 X 1080. When I run the game on my Galaxy S10+...
0
votes
0answers
40 views

High speed collision detection using separating axis theorem

I’m using the SAT and the minimum translation vector from it to detect and handle collision in my 2D game. It works great for regular speeds, (i.e. when the speed is low enough so that an object doesn’...
0
votes
2answers
83 views

Can I use the 2d physics engine in a 3d game (or viceversa) in Unity?

This is entirely for performance. The 2D physics are less expensive, but I require 3D for some scenes. I never need both at the same time. I know you can have 2D with an orthographic perspective in a ...
0
votes
0answers
33 views

How to make the intersection area of sprites transparent if they have the same color?

There are several sprites of shapes in different colors. I can move these shapes. When I move them, I want the intersection of two shapes of the same color to become transparent. As far as I ...
0
votes
2answers
119 views

Why does my Enemy A.I stop moving when it hits the wall, and how to fix it?

I am making my 2D platformer game at the moment, and I am still a beginner. I saw this tutorial on youtube in which he showed how to make an enemy a.i move. He manages to move it but he didn't show ...
0
votes
1answer
39 views

Is there a standardized way for creating a 2D ball physics movement method?

Is there a standardized method for creating a 2D ball physics movement like you can see on gif below?
0
votes
0answers
42 views

Simulating circular motion with gravitational forces in Unity2D

I am currently messing around with a game where you control a black hole and use its gravity to fling planets at targets. I have the gravity calculations working pretty well when the planets start out ...
0
votes
0answers
113 views

Rendering detailed martian terrain for an RTS

I am trying to develop a RTS game that has: Various planets Each planet topology could vary between chock full of craters, to smooth hills and mountains planets In sum each "biome" should be unique-...
0
votes
0answers
41 views

How can I move balls along a rail?

I want to implement ball movement similar to that in the Puzz Loop 2 game. The goal consists of clearing all the balls moving on a rail, with the trailing one pushing all the others. You can watch a ...
1
vote
1answer
27 views

Problem with diagonal collision response using PyGame

So I have been having this problem for the last few days and it has me really frustrated. What I am trying to do is resolve collisions with custom hitboxes in PyGame and it looks something like this: ...
1
vote
1answer
71 views

C++ SDL2:2D tilemap with every tile has its own behavior

I am working on 2D tile based game. I want to render the tilemap from a file but every tile has its own behavior for example: magmablock : poorlava(); slimeblock : knockback(); I have this ...
0
votes
2answers
33 views

Issue with Canvas Background?

I'm preparing a 2d game. I'm working with particles, the problem is my particle is displaying on the obstacle and also a problem with level text see the reference image: and the second issue is when ...
0
votes
2answers
53 views

unity: input event consumed by image raycast target that is “under” a sprite with a 2D collider

I am having a hard time getting my UI to work. Basically I have a canvas with a UI image A that is the size of the screen. This image has raycast enabled and if effectively receiving inputs. Not in ...
0
votes
1answer
95 views

Identify an object currently selected in the game

I am making a 2D isometric game that uses the mouse. When I left click on an object, this object should be selected, but how do I determine what object that's currently selected and show a halo around ...
0
votes
0answers
48 views

Convert Flat World Angle into Isometric Angle?

My game is isometric 30 degrees (think Diablo 2), I'm looking to convert the angle A1 from the player tile A to the destination tile B into the appropriate angle A2 in the isometric view. For the ...
0
votes
1answer
79 views

Tile based game data structure

I've been working on a top down 2d game and the character moves freely around the map, like zelda link to the past. How would you model the data structure for such a game in order to implement ...
1
vote
1answer
69 views

Why is my player not giving a knock back when it stays at the right side of the enemy?

So, I have this problem I am facing, for some reason my player does not get a knockback when it stays at the right side of the enemy but when it stays at the left side it gives a knockback. What's the ...
1
vote
1answer
71 views

How to receive a Knock Back when the player touched the enemy

I'm still new to C#, making my 2D game atm and my problem is how can I give my player a Knock Back when it touches the enemy. How to add it with this code? ...
0
votes
0answers
53 views

Creating split-screen with Game class extending Canvas

Making my first attempt at a 2D two-player game in Java, but without using any external libraries. The issue I am running into is I am trying to split the window in half so two people can play the ...