Tag Info

Hot answers tagged

16

There's a number of options: Do as you do. You've already said it doesn't look smooth. There are some flaws with your current method though. For x, you could use the following: tempx += speed * dt while (tempx > 0.5) move sprite to x+1 tempx -= 1 while (tempx < -0.5) move sprite to x-1 tempx += 1 this should be better. I've switched the ...


14

One way in which many old-skool games solved (or hid) this problem was to animate the sprite. That is, if your sprite was going to move less than one pixel per frame (or, especially, if the pixels/frame ratio was going to be something odd like 2 pixels in 3 frames), you could hide the jerkiness by making an n frame animation loop that, over those n frames, ...


6

The sprite's position should be kept as a floating point quantity, and rounded to an integer only just before display. You can also maintain the sprite at super resolution and downsample the sprite before display. If you maintained the sprite at 3x display resolution,you'd have 9 different actual sprites depending on the subpixel position of the sprite.


3

it's trivial, you can do it yourself. Assuming your sprites have alpha value 0 in unused areas, you can do the following (in pseudocode): pixels_out = pixels for y in pixels.height() for x in pixels.width() if pixels(x,y).alpha == 0, neighbour_in_sprite = false for y2 in [-1,0,1] for x2 in [-1,0,1] ...


3

The only real solution here is to use bilinear filtering. The idea is to let the GPU compute the value of each pixel based on the four sprite pixels that are overlapping with it. It's a common and effective technique. You simply need to place the sprite on a 2d-plain (a billboard) as a texture; then use the GPU to render these plains. This works well but ...


2

You could just store a second image (or use the alpha channel of your image) to store a heat map (this also depends a bit on how you're drawing this, e.g. through a canvas). You just create some mapping and tint areas in their specific color (example): Left arm becomes red. Right arm becomes orange. Left leg becomes cyan. Right leg becomes blue. As an ...


1

In addition to the other answers here you can use dithering to some extent. Dithering is where the edge of an object's pixels are lighter/darker in color to match the background making for a softer edge. For example, say you had a 4 pixel square I'll aproximate with: OO OO If you were to move this 1/2 a pixel to the right, nothing would really move. But ...


1

A quote from the document you pasted: 15.070 If I draw a translucent primitive and draw another primitive behind it, I expect the second primitive to show through the first, but it's not there? Is depth buffering enabled? If you're drawing a polygon that's behind another polygon, and depth test is enabled, then the new polygon will typically ...


1

For loading the images, you could do: std::vector<imagebatch> fotos; std::vector<SDL_Texture*> healerTexture; // Parts of filename string that occur multiple times. char* filenameBase = "DData/towners/healer/healer/Healer"; char* fileExt = ".png"; // This is 15 because of the number of images there are. for (int i = 0; i < 15; ++i) { ...



Only top voted, non community-wiki answers of a minimum length are eligible