Questions tagged [2d]

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

430 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
7
votes
2answers
563 views

Shrink a convex polygon

Shrinking a concave polygon is quite hard, to do well. But I expect shrinking a convex polygon would be easy. The naive approach of moving each vertex a certain distance to the centre gives me poor ...
5
votes
1answer
188 views

Fixing the size?

My app isn't compatible with all screen sizes. When testing on a small size, my textview overlaps with my button. So, as suggested on the Android Documentation, and many stack overflow pages, I ...
4
votes
1answer
345 views

How can I rotate the game stage (Unity 2D)?

I have a pseudo-game which I'm developing in 9:16, to be displayed in vertical screens. The client now needs another version in 16:9, rotated in 90º. I tried creating a empty object, puting all my ...
4
votes
0answers
2k views

Unity 2D: How to make player grab a ledge, swing and jump to another

Since I'm not a native speaker, it's hard to explain in english what I want to achieve, so I'm gonna use a couple of images... basically I want to make an interaction of this type: in a 2D game, so ...
4
votes
0answers
221 views

Implementing rubber rope

I'm using LibGDX to implement rubber rope in which player can fly and launch. I know I could use Box2D as physics engine and I'm going to one day, but I'd like to learn it myself for now. I've ...
4
votes
1answer
1k views

How to correct this issue with a top-down aiming angle in Unity - 2D?

I'm trying to build my first project and I'd like some input for a math correction. The game is a top down 2D shooter, a bit like the iconic "chaos engine" from SNES. The issue is that either the ...
4
votes
0answers
143 views

How can I connect multiple explorable regions into one large map?

I am planning a 2-D science fiction game involving spaceships. A major thing that I am having trouble figuring out is how to create a 2-d array of smaller maps that the player can explore. My ...
4
votes
0answers
366 views

How to target moving object in 2D game

I am working on targeting system for 2D game. Two objects move in space. Each one have Position and Velocity vector. Ship object shoots moving objects in space. Ship can shoot in any direction, but ...
4
votes
0answers
4k views

How to create water with ripples in custom places for top down game in Unity?

I want to make topdown row boat game with Unity. I want graphics to be simple (sprited), but the water must be "very nice" and realistic and it should reflect movement in it (paddles and boat movement ...
4
votes
1answer
322 views

Draw GUI.Button on certain position on a scrollable background

Problem is in a 2D game I have a large background around 2 screens wide. And on there I got 4 buttons placed on top of background all over complete width. Now when I swipe of move my mouse around I ...
4
votes
1answer
530 views

How can I apply a "genie animation" to a CCSprite?

I am new to Cocos2D and following this tutorial. I want to animate a CCSprite with the genie effect that OS X uses for hiding windows to the dock and showing them ...
4
votes
1answer
131 views

How to make expanding ring with constant thickness?

I need to generate this burst or (donut-shaped) pulse. I'm having a difficult time how to generate such shape. At first, I was thinking of scaling the image but that didnt work out because the line or ...
3
votes
0answers
95 views

Faster convergence in a physics engine

I've got my hands on the first edition of the book Game Physics Engine Development: How to Build a Robust Commercial-Grade Physics Engine for your Game by Ian Millington. Because I didn't really know ...
3
votes
1answer
965 views

Loop around a 2D Tile Map

I have made an algorithm for procedurally generating a 2D tile map in Unity. The player can use the mouse to pan the view and look at the map. My intention was that when the player reaches one of ...
3
votes
0answers
320 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 ...
3
votes
0answers
125 views

Line Renderer 2d Follow the edge

I am using mouse position to draw a line using line renderer 2d. What i want is when the line hits a collider it should start to draw on the edge of the collider rather than over the collider. ...
3
votes
0answers
257 views

Quest UI Display in Unity 2D

I have this quest manager script where I store all my quests for easy duplication. I'm adding a feature that gives the player the option to see his/her current to-do quest. The first thing I ...
3
votes
0answers
46 views

Sprites being skipped over in simple sprite change script

Each instance of the prefab in question has a copy of this script on it, but they seem to be interfering with each other in some way. I would forego prefabs, except the final game I'm prototyping for ...
3
votes
1answer
2k views

How can I move a vehicle using speed and steering angle?

I want to drive a vehicle in x and y coordinate area with range from (0,0) to (6000,5000). I am using Visual Components (using Python API). On input I have speed data and steering angle of wheels ...
3
votes
2answers
694 views

Efficient 2D grid overlay on tiles without each cell being its own GameObject

So for my game I need the ability to add a grid overlay over my tilemap. Now I don't think that making the grid with each cell being its own GameObject with some SpriteRenderer would be hard to do but ...
3
votes
0answers
78 views

Unity: Messages in Compound Colliders

Lets say I have a 2D character with two colliders: a circle collider that represents the feet, and a box collider that represents the body. Lets say that the character is currently standing on the ...
3
votes
0answers
415 views

Why is my 2D mouse aim not working properly?

I'm trying to program 2D mouse aim, where the arms and the gun in the arms rotates to point at the mouse. But for some reason, the arms and gun rotate and do not follow the mouse position. The each ...
3
votes
0answers
533 views

Enabling OpenGL lighting seems to disable blending

I have the following code to set up for some 2D drawing using OpenTK. I originally wrote it without any lighting considerations, but later added the lighting block. This version of the code uses ...
3
votes
0answers
88 views

Problem with rendering in my game when using a following camera

I've got an issue while rendering 2d images with my own simple 2D camera object. First my setup: a star initial position 0,0 a planet circles the star initial position 300, 300, moves at a radius of ...
3
votes
0answers
877 views

Pixel Art size for different resolutions

What size I should make the UI elements (mostly buttons). How do pixel graphics look good on all resolutions? How would I get to know what size I need the buttons or other pixel graphics overall?
3
votes
2answers
1k views

Improving bouncing logic - Atari breakout clone

I'm creating an Arkanoid clone using Haxe and Openfl. I'm thinking the bouncing algorithms could be improved. But I'm not sure how to handle those. I was hoping you guys could help. ...
3
votes
0answers
763 views

Proper Line of Sight in tile based game

My rendering engine currently takes "xMin, yMin, xMax, yMax" to render a rectangular region of tiles, and will automatically scale based on the size of the panel it is rendering to. However, I am ...
2
votes
0answers
54 views

2D game make precise collisions

I am currently creating a personal 2D tile map game in Java. This is the first time I have attempted to make any sort of game, so I don't have a lot of techniques known by experienced developers. ...
2
votes
0answers
396 views

How to load parts of a large tilemap like chunks in Unity 2d?

I use more pictures so you can understand my opinion better. Here is the video link I recorded. My code has a problem that I use for to render it and cause it to "lag" for 1-5 seconds, so I ...
2
votes
0answers
88 views

Automatic 2d tileset textures

I am currently trying around with automatically generating a dungeon. I'd like to use this tileset https://opengameart.org/content/a-blocky-dungeon TLDR: how do I automatically apply a texture to a ...
2
votes
1answer
784 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 ...
2
votes
0answers
34 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 ...
2
votes
1answer
132 views

Rendering colors from a texcoord output

I'm trying to implement a faster alternative to super-sampling for my isometric 2d monogame game (for when the view is zoomed out). The idea was that I would render the texture coordinates to the ...
2
votes
0answers
864 views

Unity2D TileMap Collider Update Optimization

I'm currently working on a 2D tile-based side-scroller (similar to Terraria). I am using Unity's TileMap feature to draw tiles onto the screen and have my player collide with them as if they were ...
2
votes
0answers
185 views

How can I make a transparent hole with shaperenderer using stencil masking in libgdx?

I'm making a 2d game, where I need a resizeable, moveable rectangle outline. I'm trying to use stencil masking to do it by cutting a hole in a solid rectangle, and I thought this would help: How can ...
2
votes
0answers
95 views

Handling a smooth movement over slopes in a worms like game

I currently have a worms like game with the worms style pixel perfect terrain destruction. Its working well for pushing things around and watching them fall, but for the players movement it feels like ...
2
votes
0answers
400 views

Optimal solution to render sprites with transparent edges in Unity

Since I'm currently developing a 2D game for mobiles, overdraw and drawcall count is my first priority in the design of the application I've thought initially to split each sprite in two parts: one ...
2
votes
0answers
122 views

Bullets moving with the camera, not the world, Java 2D

I'm building a simple 2D Top-Down shooter game in Java. I simply cannot get this to work: I'm moving the camera and world differently. The world is moving when needed (when not in one edge, so it ...
2
votes
0answers
262 views

How to go about implementing pathfinding in Unity with Tiled2Unity map prefabs?

I have created a map using Tiled application and have added collision boxes and used Tiled2Unity to import the map to Unity. The collisions are working with key ...
2
votes
0answers
1k views

OpenGL Render Queue Design

I am currently designing the rendering system for a 2D game built in C++ and OpenGL, and am unsure about how to go about implementing a sorting procedure to maximise efficiency and minimize OpenGL ...
2
votes
0answers
200 views

Sprite animation in Android view

I'm looking for a way to have different sprite animations in individual Android views. I try to use LibGDX and AndEngine but most I could find was how to get an Activity with the sprite animation. ...
2
votes
0answers
567 views

2D Skeletal animations exported to SVG

I would like to create skeletal animations, and Synfig looks quite promising. This is a video walk through of its "bones" feature, used to do skeletal animation. Ticks all the boxes thus far, ...
2
votes
0answers
172 views

2D Polygon Collision push direction with large polygons

I have a collision detection/resolution implementation that uses the Separating Axis Theorem. Detection and such works perfectly fine, as well as resolution for most objects/shapes in my game. ...
2
votes
0answers
577 views

How to get rid of half pixel artifacts?

I've been having a bit of trouble using OpenGL to make 2D games. I am using a traditional ortho perspective with just some sprites being rendered and moved around. It all works perfectly but there is ...
2
votes
0answers
295 views

scale rotating boundingbox

I want to use basic rectangular collision detection. I have a rotating sprite and a method that calculates the bounding box every time in the Update() method. I simply check for intersection between ...
2
votes
0answers
217 views

How can I use iteration to lead targets?

In my 2D game, I have stationary AI turrets firing constant speed bullets at moving targets. So far I have used a quadratic solver technique to calculate where the turret should aim in advance of the ...
2
votes
2answers
1k views

Unity 2D ROPE connected to moving platform

Hey guys I have realy big problem with my rope. I use a hinge joints 2D to create my rope and distance joint to connect it with moving platform. On moving platform I have a distance joint that show ...
2
votes
1answer
259 views

Is there a method to add partial scorch marks or decals on top of existing sprites?

Let's say what I have is a planet like so: What I want to do is to add a scorch mark like this: Now, if this was a one time thing, it wouldn't be a problem. I'd make a sprite for this specific ...
2
votes
2answers
5k views

Tile base Farm Simulation in Unity

I am thinking of creating a sprite base 2d top down farm simulation game. The game uses tiles and I was wondering (conceptually) what is the best way to handle the farm tiles. Each tiles should have ...
1
vote
0answers
55 views

Odd behaviour from parallax

First of all I'm going to say that I'm not trying to blow my own trumpet or anything but usually I'm able to figure this stuff out on my own. But as for now I'm fully stumped. Maybe I'm having a mind ...

1
2 3 4 5
9