We’re rewarding the question askers & reputations are being recalculated! Read more.

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
2answers
27 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
24 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
80 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
36 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
51 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
59 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
63 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
2answers
43 views

Should I use HTML5 canvas for a 2d image browser game / app?

Ok, I hope this hasn't been asked, but I could not find one, especially nothing recent. Quick Background: I've been away from programming for a couple of years and dusted off an old project to create ...
0
votes
0answers
50 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 ...
2
votes
2answers
75 views

How to display and hide complex object part in 2.5D

I am working on a 2.5D mechanical app. I use 3D software like Blender to render the 3D model to create the 2D assets for the 2D game engine (which's cocos-creator , but it doesn't matter for this case)...
0
votes
1answer
57 views

Help with NPC following the player in a sidescroller

I'm a beginner with C# and am having a bit of trouble coding an NPC that follows the player in a 2D sidescroller. The player has two speeds, a walk and a sprint. I have a very basic companion follow ...
1
vote
0answers
29 views

Automatically setting tile variations in a 2D map editor

I'm looking to make a map editor for a 2D strategy tile-based game (I am using OpenGL with SDL and writing the game in C). My game levels are made up of a set amount of different tiles, like a river ...
1
vote
1answer
64 views

Implementing a more reliable upwards slash?

I am working on a 2D action platformer and I am currently implementing an upwards slash. For a normal horizontal slash, the player must press the attack button. For an upwards slash, the player must ...
0
votes
1answer
21 views

Why boxCollider bound extents change when changing the size of an gameObject but doesnt in the script?

So, I have two players when I first made them they were with the default size Y = 1. After I finished the scripts I wanted to change their size but when I did that, ...
1
vote
1answer
65 views

Maths and basics for a 2d top down game (object moving and rotating around center)

I want to eventually create a pseudo 3d game engine like the original Wolfenstein or doom. I am starting from 0 so my first step is to create a 2d top down view where my character would be in the ...
0
votes
1answer
43 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 ...
1
vote
0answers
32 views

Blurry background sprite, other sprites fine

Why is the background blurry, but all the other sprites fine? The background sprite has the same settings as the others. It's on the same Z position (0). It happened after I made some changes to the ...
0
votes
0answers
15 views

vector image is pixelates in game view

I imported a .PNG file at 1920 X 1080 resolution but it is pixelated in game view. I also tried as a .SVG file but it also gives same result. How can I fix it?
0
votes
0answers
36 views

How to erase the small gaps in tilemap in Unity?

I want to erase small gaps in my tilemap. The gaps look like this: The texture I used has no gaps: I tried by disabling anti aliasing.It didn't worked so what can I do in this case?
0
votes
1answer
42 views

Manipulating sprite shape rendered

I wish to create a game object where you can start dragging it by touching somewhere on the line of its collision and to create these "dynamic shapes" by stretching the sprites and readjusting the ...
1
vote
0answers
22 views

2D Rigidbody with Touchscript movement in Unity won't stay in boundaries

I'm trying to make a pong game where the player has to move both paddles. They are currently set as dynamic 2D Rigidbodies (collision detection continuous) and have a box collider (is NOT trigger) ...
0
votes
1answer
17 views

I want to clamp each instance of the same prefab to the y axis only

I instantiated the prefab "paddle" twice then I tried clamping it to the y-axis only; using Mathf.Clamp, however, the min and max values end up being applied to both instances of "paddle" and hence ...
0
votes
1answer
30 views

Unity 2D Rotating Cannon to Mouse Position Inaccuracy Issue

I am trying to rotate a 2D cannon to clicked mouse position and having accuracy issue. It's working but the angle seems to be losing more and more accuracy when I move the mouse to further up or down ...
0
votes
1answer
40 views

SpriteRenderer not Rendering Sprite

Edit: I've slightly edited this question because I've found the symptom for my problem, but not why the actions I've noticed cause the issue. I have what appears (via the inspector) to be two ...
0
votes
0answers
21 views

How to make a parallax background for 2D in unity?

I tried to make a parallax background with the following codes: ...
1
vote
1answer
69 views

Can I linear interpolate color along both the X and Y axis of a circle instead of using the distance formula on each individual point?

I've been unable to make it work and I'm not sure whether it's a problem with my code or if this can even be done. I'm sure there is a way to prove whether it is possible mathematically but I don't ...
0
votes
2answers
134 views

How do I detect collisions between a point and a sloped line?

The character in my game constantly falls due to gravity, so i have to detect the collision between the bottom point of the character and the tile slope line on the same x coordinate. The character ...
0
votes
1answer
47 views

Simple 2d Movement (Non platformer)

This seems so simple but my searching as failed to find a good result. The idea is that you can move in 360 degrees but you aren't faster when you move in a diagonal direction. I know how to do this ...
1
vote
1answer
40 views

How can I clip my sprite as it passes through a portal in a 2D scenario, using OpenGL?

This is a very simple question, but after a brief search and reading through the "similar questions" I could not yet find an answer. I'm creating a 2D game using OpenGL and came across a problem: Let'...
0
votes
0answers
20 views

Sprite getting cropped in play window

Video of behaviour: https://youtu.be/yC5m6k3jf2o The worm sprite in my Scene Editor is rendered correctly. When it's in the play window it's getting cropped on the bottom an right though/ I've ...
0
votes
1answer
49 views

How to check for sprite collision without Unity's rigidbody? [closed]

I'm currently making a recreation of Missile Command, but the problem is that I'm not allowed to make use of Rigidbody functionalities in my specifications. While player missile explosion spawning is ...
4
votes
3answers
133 views

How to draw a smoother solid-fill circle?

I'm experimenting with drawing circles and have brute-forced a very simple one: Pseduocode: ...
0
votes
3answers
48 views

Both Trigger and Collision BoxCollider2D

My Player sprite needs to collide with some objects and be unable to pass through them and in other cases detect when it passes through some object (e.g. some non-...
0
votes
0answers
8 views

Lighting not working in a 2D JavaFX game when using subtracting shapes?

So im trying to add lighting into my game. I'm using shape subtracting and unions to subtract circles (the lights) from a dark rectangle that covers the whole world. I think that its a problem with ...
1
vote
1answer
29 views

Does Animator.SetBool take precedence over Animator.SetTrigger in Unity's Animator?

I've got an Animator with transitions from Idle to Walk or Dash. Walk requires isGrounded to be true and a float MoveX to be greater than .2. The Dash animation requires Dash trigger is returned. In ...
1
vote
1answer
42 views

2D sprite sorting and draw order relative to camera rotation

I'm having trouble working out how to recalculate 2D sprite sorting / draw order based on camera rotation. In the example below: Screen 1 shows a non-rotated typical "top down 2D" scene, where the ...
4
votes
3answers
111 views

How to calculate the reachable space of the end effector in an IK chain?

I have an array of points in a 2d worldspace and I want to calculate which points are reachable by the end effector of a limb controlled with a CCDIK chain (with rotation limits applied). It's a limb ...
1
vote
0answers
69 views

Flickering or jagged movements when sprites move along a curvilinear path

I'm making a top-down zoomable 2D game. I can't achieve a perfectly smooth curvilinear movement of the sprites, not even when I have a pixel perfect reproduction. I tried different approaches and I ...
0
votes
0answers
13 views

How to add lighting to a 2D Tile-based game in JavaFX?

I'm making a 2D roguelike tile-based game with Java and JavaFX. I'm currently working on adding lighting and darkness to the dungeon, but whenever I try running it, it takes a very long time to load, ...
0
votes
1answer
17 views

creating 2d array texture with mipmap

these day i am working with texture2d array with mipmapping. so this is how i tried so far. my approach load multiple(not textureArray form) textures that i want to set as array from computer folder. ...
0
votes
0answers
26 views

OpenGL 2D Batch Rendering: Textures mixing when having multiple active textures

This is what happens when I draw switching from the black texture to the lime green one in a simple for loop Here's a simplified version of how my renderer works Init(): Create my VAO and attrib ...
0
votes
0answers
37 views

What are the pros and cons of using larger tiles in a 2d game with freely placed entities?

I am working on a 2d game with the Godot Engine and I'm about to start drawing the tiles for the ground tileset. These will be used solely for the purpose of painting the ground because the trees, ...
0
votes
1answer
48 views

Unity Raycast not detecting layers

I am having problems with layers detection using raycasts. Context: I created a grid to use in a pathfinding algorithm on a 2D plane. I want to implement now different weights according to the layer ...
0
votes
1answer
34 views

MoveTowards giving two different results for same input - Unity

I have prefab and its hierarchy is as follows: bird -Outline --mask --filler Now I am using this in Update to move the filler: ...
0
votes
0answers
49 views

Modifying A* pathfinding based on size of moving object [duplicate]

I've implemented basic A* pathfinding in my top-down 2D game, and I'm almost ready to test it, but I thought of something while adding the movement code to my enemies that I think could affect the ...
1
vote
0answers
61 views

How do I prevent falling tiles from bouncing on each other in my match 3 game?

I am working on a match 3 game in Unity. The tiles have a RigidBody2D in dynamic mode and a BoxCollider2D. When a match occurs ...
0
votes
1answer
19 views

Sprite is getting out of screen when changing resolution - Unity

Hello I am making this layout: I used sprites for birds but used UI for the blue food thrower. I used UI for it so it will not get cut when screen resolution changes. But I also need to add food ...
1
vote
1answer
48 views

Rotating UI element using touch for mobile - Unity 2D

I want to create the above object that will rotate on z-axis following the direction of a finger. Like a dial. I have written the following code and attached it to that element: ...
0
votes
1answer
36 views

how to calculate resulting velocity and angular velocity rocket has on center of mass

The issue i am having is that i can't seem to figure out how to apply force from a rocket to a bodies center of mass. *Edit This is in 2D e.g. Let's call the body 'ship' the 'ship' is 1000 (...
0
votes
0answers
17 views

Is it possible to use gyroscope to produce a parallax tilt effect in Unity 2D?

I want to produce a parallax tilt effect in my 2D game that i will start working on. before that i want to know is it possible to produce the parallax effect (same as iphone parallax background) in ...