Tag Info

New answers tagged

1

Unity colors have 4 float values typical of many color formats RGBA, corresponding to the individual percentage color values Red, Green, Blue and the Alpha transparency channel. Also as mentioned above the default "Tint" applied by Unity is a multiplicative shader Photoshop calls this effect "Multiply" and the process is literally multiplying the color ...


0

One way to do this is with mask textures. When you cut a sprite A, you will divide it into two new sprites (B and C). You can create masks based on where the user dragged to create the cut, and use those masks to represent the transparent portions of the new sprites (the parts that were "cut away"). Say the user traces the following pattern: You can use ...


1

Try sprite.setOriginCenter(); This should help


0

I have a simpler solution without using any physics or rigid bodies. For your character, it need to have both x,y position as position in screen and i,j as position on the grid with a flag called isMoving. When the character wants to move to i+1, j. Check if the cell at i+1, j is free. If so, set flag isMoving to true and set character i,j to i+1, j and do ...


0

Actually, there's no ready response for your problem. You can solve it in a variety of ways. If you are working with a "tile-like movement", you can simple check the next tile to see if is passable and only compute the movement if it is. It's a simple check if you have a array representing your world. Or a limited raycast if not. Also, Unity documentation ...


0

The easiest way to accomplish what you're asking is to split the objects up into different parts and animate them separately. From there you can either use a bone and joint system (similar to what Flash developers do) or, as you said, each part has its own animations.


1

From my understanding a spritefont is essentially a collection of sprites where each letter translates to a coordinate on a spritesheet, such as the following: You can do this manually, of course, but it would be a pain to check each coordinate. You can use BMFont to do the conversion for you, which creates an image such as the one above, followed by an ...


0

You can use Path2d to define the outer edge of your rounded rectangle. This actually creates a Shape. To turn this into something you can use, FlatteningPathIterator can be called to create a list of points that can be used to step along the path. You can use this information to draw your circle as it progresses around your progress bar. Here is a good ...


0

It's unclear what you're asking, but based on everything you stated I don't see any issues. Position is (0, 0), the texture dimensions are 20 x 20 and the origin which you specified in the Draw method is new Vector2(texture.Width / 2, texture.Height / 2). What I see in the screenshot appears to be correct, with the top left corner of the texture being at ...


0

This is a debugging issue. The image gets drawn where you are telling it to be drawn. The problem is you are not telling it to draw in the correct place. Use the debugger to examine Position when you enter the Draw() method. My guess is that Position will not have the value that you are expecting. If this is the case, look through your code, and find where ...


0

The line we're interested in is Position * 20 which, if Position is (0,0), is equal to (0,0) and you say it behaves correctly for Position * 20 + new Vector2(10,10) which is equal to (10,10) I'm guessing that the problem is a misunderstanding of order of operation. Adding parenthesis to show what happens first, we would have: (Position * 20) + new ...


1

"Which of these options is better from a practical point of view?" I'll interpret the word "practical" here to be distinct from "theoretically highest performance on a computer"... At two triangles per sprite, recomputing all the vertices on the host CPU will be not that expensive, & easy to think about. Or, since all the geometries are the same (two ...


1

You aren't limited to having only one MVP per VBO. So you would not in fact need to update the VBO every frame just because you stuff all of your sprites into a single VBO. What I do is store an instance ID with each vertex, which changes only on a per-model basis, and use those instance ID's to index into a uniform array of mat4's, one for each "instance."


1

You'll want to look into pixel-art upscaling filtering algorithms (http://en.wikipedia.org/wiki/Image_scaling). These have been specifically designed to upscale pixel art, having the properties of (1) retaining the original color palette (aka. no blurring) and (2) removing jaggies (aliasing that occurs due to nearest neightbour sampling). Some names of ...


-1

You need to apply a low pass filter before the down-sampling (down-scaling) occurs on the low resolution screens. I have used simple gaussian blur (convolution transform) with good results: This was done with a blur radius of 1 pixel.


5

For one, nearest-neighbor will result in pixel perfect scaling only if it's used to upscale in integer multiples. Apart from that, you should not be conducting any scaling operations on your view/projection matrices. If you set your view to match the dimensions of the screen, and your projection matrix to be orthographic with dimensions that match the ...


2

You need to average the sprite pixels which are visible beneath each screen pixel. The sprite pixels can be sampled "nearest", but to move smoothly in subpixel increments on the display, you need some kind of oversampling. If you're using OpenGL, you can do this in your shader by averaging 4, or 9 or more sprite samples offset near each fragment (calculated ...


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



Top 50 recent answers are included