2D games are drawn in a two-dimensional space using two-dimensional objects. To represent its position, each game object will have an `x` and a `y` coordinate.

learn more… | top users | synonyms

2
votes
1answer
128 views

2D lighting causes black rings to appear

A year ago I implemented 2d lighting in XNA using sprites. The sprites I used were created by placing a soft white photoshop brush on a transparant background. The result was this: (lights only) ...
1
vote
2answers
91 views

How can I compute the movement of an object along a parabola?

I am working on a simple 2D game. In the game, I have a 'robot' that throws a ball towards another robot, in the shape of a parabola. Both 'robots' have the same Y coordinate. The program knows the ...
8
votes
2answers
1k views

What is the difference between Unity's Sprite and Texture2D classes?

Unity has both a Texture2D class and a Sprite (with related SpriteRenderer). What is the difference between these two classes? Both represent an image, for 2D games should I favor one over the other? ...
2
votes
1answer
4k views

How can I programatically generate sprite instances in Unity?

I want to create a block-based puzzle game that generates blocks as they are required, however I cannot seem to find any good imformation on how to do something like this using Unity's new sprite ...
0
votes
1answer
180 views

How do you do FlashPunk-style animation in libGDX?

In FlashPunk, you can have multiple animations set, and then choose which one to play at any time, and it'll do it. Example: animatedSprite.add("running", [0, 1, 2, 3], 50); ...
0
votes
2answers
170 views

How can I regulate update and event frequency?

I'm trying to create a small 2D RPG-type engine using C++, SDL/OpenGL and Tiled. My little demo looks very similar to a Pokemon or Zelda game. I was curious how to go about regulating FPS and how ...
0
votes
1answer
125 views

How can I support a background more complex than a flat color?

I'm a beginner at making 2D games. Up until now, I always created my games with a black background, or a fixed color. This is because my sprites always have a black (or a solid color) background, and ...
2
votes
1answer
131 views

How do I rotate a bounding box together with a sprite?

I have a game object with a sprite that can rotate. It's a rectangle. I need its bounding box to rotate with it. How do I make sure that they can both rotate, but they're always both at the same ...
0
votes
2answers
276 views

translating canvas for rotating sprites that shoot

I am trying to align bullets to my different sprites guns (top down 2D for android). Right now Im using this method to draw my bullets: public void draw(Canvas canvas){ update(); ...
2
votes
2answers
129 views

Should widgets be part of a scene in a 2D game?

I'm in the middle of separating logic and drawing of a 2D game, i.e. I'm moving from scenes/entities that draw themselves to scenes/entities that merely store and update data, getting drawn by a ...
2
votes
1answer
126 views

How to smoothly track and draw player movement?

I am currently using C# XNA Framework to simply connect some development concepts that I've learned/used over the past few months. Right now I have a Web Service that keeps track of connected clients ...
-1
votes
1answer
873 views

No collision detected with 2D rigidbody

No collision detected with 2D rigidbody 0 I have a ZombieBoy with a circle collider2D and a box collider2D and a RigidBody2D . The player shots energy balls which has a Circle Collider2D and a ...
1
vote
1answer
163 views

Is setting the render target back to backbuffer supposed to take long?

I am creating a game in Monogame (XNA extension). I draw to a render target to display menu items for my game. Everything works fine, however... Whenever I set the render target back to the back ...
1
vote
1answer
300 views

What is difference between AndEngine's three Cameras

I am new to game development. After observing some AndEngine code snippets, I am trying to figure out which camera would be best suitable for my 2D game. Either it's BoundCamera, SmoothCamera or ...
1
vote
3answers
405 views

Calculating 2D Physics Prediction of Shot Angle with Moving Velocity of both targets

I currently have the math right to hit a moving target with 99% accuracy as long as I don't move. When I start moving the aim is nearly 80%, it should also be 99% accuracy because the target is moving ...
1
vote
1answer
101 views

Better way to handle ordering and visibility of renderable objects?

I'm just wondering whether there is a more effective way to handle the ordering and visibility of renderable components that fits into the design of my already existing engine. How I do it now: In ...
0
votes
1answer
117 views

Load all bitmaps at once or only when needed?

I am starting to get a pretty hefty amount of bitmaps in my 2d game for android. I load them all in 3 colors to save some memory but the thing is, I load all of them when "Start game" is pressed, even ...
0
votes
1answer
200 views

Scaling background without scaling foreground in platformer?

I'm currently developing a platform game and I've run into a problem with scaling resolutions. I want a different resolution of the game to still display the foreground unscaled (characters, tiles, ...
1
vote
1answer
164 views

AABB vs Rectangle

I'm trying to wrap my head around 2D physics and stumbled upon Axis Aligned Bounding Boxes, and I have a couple of questions regarding them. In all AABB structs I could find out there, people prefer ...
1
vote
1answer
136 views

Is the Key Bindings delay unavoidable in Java when pressing different directional keys quickly?

I've read just about every tutorial I can on why to use Key Bindings instead of implementing the KeyListener interface, including all the examples that show using a field to track the key event ...
0
votes
1answer
113 views

Java 2d game cross-platform compatability

I need to make a few small, simple 2d educational games primarily to help kids improve their reading. Drag & drop/matching words with pictures, spelling out words as well as maybe a scrolling ...
0
votes
1answer
143 views

Questions about networking theory in a 2d shooter game [duplicate]

So currently I am starting to work on a 2d top down space shooter game, and I have just got to networking. So far the client can draw a ship at a desired x, y and rotational coordinate with any set of ...
0
votes
2answers
106 views

very simple math destination and speed calculation

My player goes to (destinationX, destinationY) His position is: (x,y) and the player has an update event function update() { this.x = this.x + dx; this.y = this.y + dy; } what is the formula ...
0
votes
0answers
207 views

2D Sidescroller camera

I'm using OpenGL. For my tiles, I'm using a display list and I'm just using immediate more for my player (for now). When I move the player, I want to center him in the center of the window, but allow ...
-1
votes
0answers
51 views

Draw object to screen without being affected by rotation / zooming [duplicate]

I have a 2D game, with a camera that follows the main player. In the game the camera may also rotate the view around the player / zoom in or out on the player. Let's say I want to add a mini-map to ...
1
vote
1answer
102 views

Does a 2D Vector or 2x2 Matrix play any role in 2D Transformations?

I'm having trouble trying to figure out if a vec2 or mat2 class are used at all in transformations for 2D rendering. Vec2, apart from representing UVs, AFAIK, is relatively pointless in regards to ...
-1
votes
1answer
42 views

Movieclip to spawn in in a set perimeter

I like to make a movieclip randomly spawn in a set area. But theres a little more to it, usually you'd have something like the X pos set to something like 250 (say the centre) and the Y pos set to be ...
0
votes
1answer
192 views

3D rotation and movement of ball on a 2D plane

Here is a video of Amiga arcade pool game: https://www.youtube.com/watch?v=zTQIPFBUFIg I am making a similar game with C and Gtk+3.0 but I don't know how to show balls 3D movement on 2D plane! I ...
2
votes
3answers
187 views

How to manage game objects, npcs, items? [closed]

i'm making a small 2D game, designed the maps with Tiled, and adding "basic" world object/items/npcs/mobs to test it a bit and have fun. Now i have encountered a relatively huge problem, with further ...
2
votes
1answer
360 views

How to split a 2D sprite tile set into individual sprites?

I see a lot of sprite catalogs for games provided as single PNG image, like the one below. I'm interested if I have to manually create tiles from that, or if there's some program that can split it ...
0
votes
1answer
132 views

What size textures do I need for a 2D grid based game if my tiles are larger than textures I have?

I'm building a grid-based game for iPad, and for usability purposes I've selected my game grid to be built of 75x75 squares. However, so far I've seen that the majority of (free)texture catalogs I can ...
0
votes
1answer
83 views

Why is interpolation passed into the rendering routine when the position and speed are related to the update routine?

I've read this in several well known articles, including this one: http://www.koonsolo.com/news/dewitters-gameloop/ Under the Interpolation and Prediction subheading is the description of the ...
0
votes
2answers
75 views

Angluar movement

I'm making a little game where you are a spaceship and you fly around in 2d using the A and D key to rotate and the W key to accelerate. Now my problem is if i turn my ship it doesn't go into the ...
0
votes
1answer
54 views

Farseer Circle Body Problems, Please help!

I have created a circle body class, but in game my player body just passes through it. the circle will not move, only rotate. however when i create the circle body just straight up, raw in the game1 ...
5
votes
2answers
998 views

How do I make a 2D game resolution independent?

I'm working on a simple 2D game. I've finished the mobile phone version. However, my boss wants the game to works on his RT. I'm doing the "conversion" but my buttons are in the wrong places, because ...
1
vote
1answer
227 views

Lighting Covering Up Sky ( XNA / C# )

I have a 2D tile-based lighting system which is drawn onto a Render Target. I am also drawing a background which involves mountains, sun/moon, and clouds. There is also the unlit game; blocks, ...
0
votes
1answer
214 views

Creating a knockback effect

I'm fairly new to creating a 2D game in java and I'd love some help. I'm trying to create a sort of knock back effect the enemies have on you. So when you are touched by a enemy you will: lose life ...
0
votes
1answer
160 views

Efficient approaches to updating adjacent grid tiles when one tile is disabled?

I'm trying to update the surrounding grid of tiles if one of them is disabled (not removed). For example, imagine we have a grid of tiles each with x representing one texture: x, x, x, x, x, x x, x, ...
0
votes
1answer
99 views

Map color collision problem

Hello i'm doing a game in WPF, 2D version (top view) I have the map and i'm trying to check for color collision in pixel each time the timer is activated Well...with 1 object it works fine but with ...
0
votes
0answers
15 views

How should I go about making a tile map in Allegro? [duplicate]

How do I make a tile map for Allegro?
1
vote
1answer
192 views

How can I implement jumping in a 2D game using bounding box collision?

Problem: I'm trying to implement basic jumping to my 2D game engine, but have failed several times. Basically what I've done so far is disabling gravity and using a separate function moving the player ...
2
votes
1answer
396 views

How can I create 2D shadows that let me detect when the player is inside them?

I'm working on a 2D platform game, and I want my platforms to cast shadows along with some way to detect if the player is inside the shadow area (that is, not hit by the sun). More specifically: I ...
0
votes
1answer
113 views

When to use class/objects for graphics [closed]

I am fairly new to game development, but I have a good programming background with object oriented programming. But with games, I do not know when I should use an object (or class) for an entity on ...
2
votes
0answers
253 views

Help with 2D sprite instancing [closed]

Alright, so I'm pretty new to OpenGL programming. I've been writing my own engine, initially using the fixed function pipeline. I then did a 1:1 replacement of the fixed-function methods with shaders ...
0
votes
1answer
515 views

Directx 11 , problem positioning a 2D quad , center starting at bottom left and not top left

I'm following some tutorials of directx 11,and i was able to draw a quad, but my problem began when i was applying transforms , for some reason, my quad at position 0,0, start at bottom left of my ...
2
votes
2answers
1k views

Algorithm for continuously generating a tile map for a topdown 2D game? [duplicate]

In essence, what I'm looking for is a procedural 2D tilemap continuously generated in a fashion like Minecraft - which is to say generated as the player approaches the edges of the already explored ...
1
vote
2answers
122 views

Moai: Clipping an image to a polygon

I'm using Moai SDK. I have an image and some random convex 2D polygons. I want to show only the parts of the image inside these polygons. Here's an example image: The same, shown only where the ...
0
votes
1answer
135 views

Programming and drawing to deal with different screen sizes and resolutions

I started making an XNA game years ago and picked it up recently. I'm looking later to convert it to use Monogame so that it can be deployed on various mobile devices and OS, though I have a sinking ...
4
votes
1answer
991 views

Faking 2d light using shader (Unity, Shaderlab)

Since the concept was difficult to explain in words for someone who's not quite familiar with shader, I described it in pictures. I'm currently using Unity and it seems Shaderlab is the best choice ...
0
votes
1answer
174 views

Circle-Rectangle collision velocity adjustment

I created my circle vs. rectangle method based on this algorithm: http://stackoverflow.com/questions/401847/circle-rectangle-collision-detection-intersection Currently, I have a dynamic ball with ...