Tag Info

New answers tagged

0

I want to thank everyone who took their time to respond to my question. I finally came up with my own solution, which nevertheless was inspired by the suggestions here. Especially this comment from Ali.S turned out to be particularly useful: Just an idea, but you can provide your shader with another texture, representing the height of that pixel, and ...


1

The documentation shows the correct usage of the NinePatch: public NinePatch(TextureRegion region, int left, int right, int top, int bottom) left - Pixels from left edge. right - Pixels from right edge. top - Pixels from top edge. bottom - Pixels from bottom edge. Additionally you can find a tutorial ...


0

I would try using a screen buffer to draw all the walls (and possibly the characters) to. And then you can apply the perspective to all the walls at once. This should eliminate any errors you are getting because perspective is being applied to a single image rather than multiple images. You would than assemble the scene by drawing floor layer and then the ...


3

I've never had this problem before, but I've also noticed you're using BufferUsage.None. This enum has two possible states: None and WriteOnly. In all my coding, I've always used WriteOnly. From the documentation for BufferUsage, it states that WriteOnly does the best memory location for writing/rendering, but the downside is you can't read the data from ...


0

What you need to do to draw a quad with x,y as its top left coords, r as rotation, and cx and cy as the center of rotation (relative to its x,y coord) : - translate(x,y) - rotate(r) - translate(cx, cy); - draw. - (reverse/pop the matrix if required. etc) For your case, try this: ... glTranslatef(hero.xValue(), hero.yValue(), 0); glRotatef(0, 0, 0, 1); ...


1

The transformation Matrix to transform from the space on the left to the space on the right is [1 0 0 1 ] [0 1 0 -1.5] [0 0 1 0 ] [0 0 0 1 ] Well this is not correct, the matrix you have shown is actually to transform any point from the space on the right to the space on the left. The correct matrix to transform from the ...


0

One of the programmers on my team figured out something which is good enough for our purposes. It is not exactly the same as the output of whatever X-Com is using. We take the whole tiles given to us by the Dijkstra pathfinding algorithm on the set of tiles and start at one which we can guarantee is an edge. We define a forward direction and a perpendicular ...


1

That is not really an accurate normal map, by the way. You are just sort of assuming that the regions of the image where the luminance varies correspond with surface contours. That is frequently the case, but not necessarily - particularly in a subject this filthy, there will be a lot of dirty areas that appear to a sobel filter as contours rather than just ...


0

Hmm... like the other answerers, I'm going to make some guesses about unclear information in the question. My assumptions: Your map is essentially 2d, and projected downward onto the walkable surface Your map is represented as a set of polygonal areas Adjacent areas share 2 (or more) vertices If that's true, one approach is to: Collect the edges of ...


1

First of all, I think the grid is pseudo-3d: 2D movement area, but create vertical lines when the height changes. Given that, check this answer, as the same principle applies.


1

Create your points so they form a solid line on a 2D plane. Walk the line starting with a point that's on ground level, for each point: If the ground is above or below the current position, add a new point, and shift the existing point and all remaining points up or down to meet the height of the ground. -Continue until all points have been touched. You ...


4

What shapes are you using? If your shapes are convex (like circles, squares, rounded rectangles), you can just draw versions of different size and clip them to a triangle whose diagonal goes from upper right to lower left. I.e., zoomed in, light-to-dark: and dark-to-light: Then clip that: And then combine the two bezels: and finally draw the ...


0

You could get a bevel effect by underlaying the cells with upscaled graduated transparencies of themselves. This can also be used to get a glow effect.


-1

I see two possible solutions. One, is to use a 3D Vector even in a 2D space, and keep one of the coordinates fixed to the same number. Another one, is to create two different classes, Vector2 and Vector3, both inheriting from a base Vector class, and make your systems work with this Vector class directly, looping trough its components.


5

Use a 3D vector. For your 2D components, simply ignore the third component. The extra "cost" of an unused float is trivial in comparison to the rest of your architecture, and things like std::unordered_map<std:;string, Component*> are of far greater performance and memory concern than an occasionally-unused float anyway. You say that this would be ...


0

The easiest solution would be to create the graphics at the size of the highest resolution, but older iPhones have little memory so this solution would only work (smoothly) on the newer models. Instead you should target 2 resolutions. 1920 x 1080 for the iPhone 6(+) and 1136 x 640 for the 5(S). In this way you will only have to downscale for the iPhone 6. ...


0

Before you do anything with your program, check which phone the app is on and edit the screen size based off that. Apple Developer site --> UIDevice class. this class lets you get software and hardware information about the specific device your running. then do a series of if else if statements that 1 by 1 compare, when it matches, it sets the display, ...


1

You need to think with Portals :-) Make the playing field large enough that a player can't see from one end to the other (e.g. using fog). That way, a player can never see two instances of the same opponent. Of course weapon ranges need to be limited appropriately as well. Then, when a player nears the edge of the playing field, just draw a second copy of ...


0

The problem is that L.Direction vector is not normalized, so the dot product "max(dot(v, toEye)" is calculating |v|*cos Θ instead of cos Θ, which is not what we want. So normalizing it on CPU side solves the problem. Thank you @snake5 for helping me on chat with it.



Top 50 recent answers are included