Tag Info

Hot answers tagged

4

You should consider using a plain 2d-array or alternatively an array of rooms, where each room is a 2d-array or a grid. A grid would looks something like this: The player is the yellow dot and the blocks are the green ones. if the player is the light gray square, you only need to check for blocks that around that square area. This saves you the time of ...


2

You're on the right track. Not only do you have to divide the window's width and height in half, but you also have to divide the image's dimensions in half. Pseudocode would resemble something like this: // Center image in middle of screen. image.setCoordinates((screenWidth / 2) - (image.Width / 2)), ((screenHeight / 2) - (image.Height / 2))


2

Note that even though your chunkArray instances are all supposed to cover different areas of your world, their indices still all range from 0 to Chunk.chunkWidth and 0 to Chunk.chunkHeight respectively. Therefore, you should make sure that whenever you access chunkArray the x- and y- indices do not go out of these ranges. The easiest way to make sure they ...


2

Here is my two cents: All the work can be found on here too so you can run it and see how it works http://ideone.com/xKWAip Separate it into pieces and you can see how it'll work with a wee access expression after flattening the initial map array. Here is what I used to generate your map (at the moment it's square only but as long as your width and length ...


1

In java you can use an RGBImageFilter and a FilteredImageSource to change the individual pixels of an image before you draw it. Image screen = //render screen to image if(timeSinseStartWarp>0){ ImageFilter effectFilter = new Warpfilter(timeSinseStart); screen = createImage(new FilteredImageSource(screen.getSource, effectFilter)); }


1

You're not setting the projection matrix correctly. At the time you call glOrtho() you probably want to have the GL_PROJECTION matrix mode enabled. Something like that // set projection matrix GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, 1920, 1080, 0, 1, -1); // set modelview matrix to identity ...


1

I have no idea about how JSON of the libGDX parser works, but from what I can see, only keys with a value of 0 were removed. So in your code, if you cannot read the value from the JSON, put 0 as the default one. Also, you can play with the JSON parser to have a better print if you want: http://stackoverflow.com/questions/23401431/libgdx-json-parsing


1

For your collision I would merge adjacent colliding tiles together into one big collision box instead of iterating over every single tile and checking their individual collision. Also I think that a quadtree would work much better than your current approach with a HashMap as it splits your gameworld up in sections and make it easy to delete a section of ...


1

The formula for reflecting an incoming vector v across a unit normal n into an outgoing vector v' is v' = v - 2*dot(v,n)*n You can determine the normal n from normalizing the difference of the collision point and the center of the circle. See the question on How to get a reflection vector? over on Math.SX for more elaborate derivations.


1

Since Unity 4.2 there is a class called Androidjavaproxy which can do exactly what you are looking for. This class can implements any Java interface in Unity.



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