2d

2D Game Engines?

Some friends and I are just starting a small 2D game project (sort of a Shoot 'em up type game) and, not wanting to reinvent the wheel, we are looking for a (free/open source) game engine. So far, the candidates are Allegro (C++) and Pygame (Python). Are there any others we should be looking at? Are there any reasons to choose or not to ...

Creating nice animations with low framerate

Ok, this might sound like a stupid question but i want to know if there is any recommendations on how to animate objects as smoothly and quickly as possible when you know you will have low framerate. What my animation does is that i move approximately 10 2d-rectangles(containing a texture each) about 500 pixels in both x and y and i als...

How to create a tiled map in Java?

So I have a tile image tile.png and I'm trying to create a tiled map all across the window. I'm building this as an applet. This is what my paint method looks like, but its not effective. When I run the applet it takes about 2 seconds and the entire screen is painted from left to right with the image, rather than everything rendered at o...

How to read sprites from a spritesheet in Java?

I have this sprite sheet: How can I read the sprite that I want to out of these? ...

How to show Pacman's mouth open/close animation in Java with double buffering?

I'm trying to show the famous mouth opening/closing animation of the pacman character in a throwaway pacman game I'm making to teach myself game programming. What I'm doing is drawing the open mouth image, then redrawing the closed mouth image at the exact same (x/y) location. But this doesn't work, and I just see the closed mouth anima...

Pacman maze in Java

So I'm building the pacman game in Java to teach myself game programming. I have the basic game window with the pacman sprite and the ghost sprites drawn, the pacman moves with the arrow keys, doesn't move beyond the walls of the window, etc. Now I'm trying to build the maze, as in this picture: Without giving me the direct/complete ...

How to represent a 400x400 window as a map in a Java game?

I'm building a pacman game. Basically, I want to have a map representation of this window consisting of blocks/tiles. Then as the pacman character/ghost moves i would change their position on the map to represent what's on the screen, and use that for collision detection etc. How can I build this map, especially since the screen is made...

How to build a Tiled map in Java for a 2D game??

Not sure how to approach this problem. Basically, I want a Pixel -> Tile representation of a 400x400 window. Each coordinate on the screen, e.g 120x300 should be part of a tile. My smallest sprite is 4 pixels, so we can say that 1 tile = 4 pixels. The player and enemy sprites are all 20 x 20, so each player/bad guy will occupy 5 tiles. ...

Ray-Polygon Intersection Point on the surface of a sphere

I have a point (Lat/Lon) and a heading in degrees (true north) for which this point is traveling along. I have numerous stationary polygons (Points defined in Lat/Lon) which may or may not be convex. My question is, how do I calculate the closest intersection point, if any, with a polygon. I have seen several confusing posts about Ray T...

Why doesn't glCopyTexSubImage2D copy my square correctly?

here is the output: http://i43.tinypic.com/9a5zyx.png if things were working the way i wanted, the colors in the left square would match the colors in the right square. thanks for any help regarding the subject #include <gl/glfw.h> const char* title="test"; GLuint img; unsigned int w=64,h=64; int screenwidth,screenheight; void enable2...

Simple physics-based movement.

Hi. I'm working on a 2D game where I'm trying to accelerate an object to a top speed using some basic physics code. Here's the pseudocode for it: const float acceleration = 0.02f; const float friction = 0.8f; // value is always 0.0..1.0 float velocity = 0; float position = 0; move() { velocity += accelera...

Can i move the origin when doing a rotation transform in Quartz 2D for the iPhone?

Sorry if this is obvious or covered elsewhere, but i've been googling all day and haven't found a solution that actually worked. My problem is as follows: I am currently drawing an image in a full screen UIView, for examples sake we'll say the image is in the bottom right corner of the UIView. I'd like to do a rotation transform(CGAffin...

Corner Stitching Datastructure, Any Open Source Implementations?

I recall learning about the corner-stitched data structure a number of years ago and have been fascinated with it ever since. It originated with a paper by Ousterhout. I've searched and not been able to find a free/open implementations. I'd prefer a C++ implementation, but at this point would accept any pointers people might have. No...

Fast way to implement 2D convolution in C

I am trying to implement a vision algorithm, which includes a prefiltering stage with a 9x9 Laplacian-of-Gaussian filter. Can you point to a document which explains fast filter implementations briefly? I think I should make use of FFT for most efficient filtering. ...

How should I do multiple animations on the iPhone?

I'd like to animate multiple pieces for a game and i'd like to have those pieces move in different directions so my current method of animating an entire view will no longer work. I'm wondering what is the best practice for animating multiple items at once. (Note i'm rendering in 2d so i'm not currently interested in 3d soltuions.) Th...

Compute intersection of two edges

I have this big graph of edges and vertices in 2D space. The big graph is returned by a function computed in a C++ library. I am reading this graph and using it to compute all the intersections of its edges (the lines segements). I use sweep algorithm. For detecting the intersection of two edges I have though some problems. I have 4 diff...

XNA 2D Game Engines

I am just getting back into game development and I am really impressed with XNA. My only problem is that I want a community based 2d game engine so that I can harness the power of the community. Does anybody know of a good XNA 2d game engine that is currently being supported or Do I just have to write one myself? ...

What is currently considered the "best" algorithm for 2D point-matching?

I have two lists containing x-y coordinates (of stars). I could also have magnitudes (brightnesses) attached to each star. Now each star has random position jiggles and there can be a few extra or missing points in each image. My question is, "What is the best 2D point matching algorithm for such a dataset?" I guess both for a simple lin...

Place random non-overlapping rectangles on a panel

I've a panel of size X by Y. I want to place up to N rectangles, sized randomly, upon this panel, but I don't want any of them to overlap. I need to know the X, Y positions for these rectangles. Algorithm, anyone? Edit: All the N rectangles are known at the outset and can be selected in any order. Does that change the procedure? ...

Pygame: Sprite changing due to direction of movement.

I've just started learning how to use pygame yesterday. I was read this one book that was super helpful and followed all its tutorials and examples and stuff. I wanted to try making a really simple side scroller/platforming game but the book sorta jumped pretty fast into 3D modeling with out instructing how to make changing sprites for m...