Tag Info

New answers tagged

0

It sound to me as though you already have an entire map of the town drawn up and you are trying to break it down into 16px X 16px tiles for the sole purpose of adding triggers and colliders etc. Why not just keep the map as its own object and put your collider and trigger objects over it where you need them to be? Really, a tile based map might be better ...


0

It seems that scaling the images for the buttons from 1024X96 to 798X75 while targeting a default resolution of 800X600 solved the graphics corruption. I wish I knew why this was the case, but I will take a win any day. Thanks to all who have contributed.


0

Something like this: selected_character++; if (selected_character >= num_characters) { selected_character = 0; } and you can select the sprite by gameObject.GetComponent<SpriteRenderer>().sprite = Characters[selected_character]; You also have to declare a new class member to make the code above work: int selected_character = 0;


3

You have only two main options, both of which have serious pros and cons: Use normalized positioning, so that the X and Y coordinates are expressed effectively as a percentage of the available width and height. Use absolute positioning, so the X and Y coordinates are exactly the pixel or point coordinates of the sprite on the screen. Relative positioning ...


1

Here's how I've approached this situation in Unity in the past: I create a custom shield shader that accepts some number of vector parameters (typically 3 or 4), each representing a recent hit. The xyz components are the position of the hit in local coordinates, and the w component is the intensity. Within the fragment shader, I compute the object-space ...


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 ...


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 ...


0

Floating point is the normal way of doing this, especially if you're eventually rendering to a GL target where the hardware is quite happy with a shaded polygon with float coordinates. However there is another way of doing what you're currently doing but slightly less jerkily: fixed point. A 32 bit position value can represent values 0 through 4,294,967,295 ...


0

If you could generate a texture which is about the normal on the surface of the object you want to show the shield. There is no need for shaders. First, you need to prepare a cellular texture like the reaction in the picture, which should be transparent. Then, about the reaction when hit by the beam. Then, you need to prepare a(maybe several) dome for ...


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.


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, ...


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 ...


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 ...


0

I don't how you want to implement what I gonna say, but in most 2d game engines we have something called TouchListener (or in general term EventListener) which can assigned to your card sprite (and many things else) and tell how should your game card handle touches. I can bring you a piece of code which is for a Game Card that I wrote in cocos2d-x engine. ...


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 ...


0

I tried this and it works perfectly, if you would like the gamemaker file, tell me... So the alien image make three more image indexes.. Or to be way simpler make three more seperate images of the alien, Make a normal image of the alien, a green, a yellow, a red, and look online for some explosion gif. So if your laser beam is an object and not just a ...


0

If they get blurred be aware to import them in "Advanced" mode and disable "Mip Mapping" generation. Next check if any level of compression or filter is applied. Sometimes the filter tend to eat details of your image (try Point Filter or Bilinear Filter with small Anisotropic Level) Also the best result is obtained when your textures are painted "pixel ...


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] ...



Top 50 recent answers are included