Tag Info

Hot answers tagged

30

It will cause one CPU core to always run on 100%. This usually doesn't cause any harm to the system. CPUs are designed to run on 100% for hours. But on a mobile device it will drain the battery quickly and heat up the device, which will likely cost you about a stars in your store ratings. On a desktop computer this is less of a problem, but it will consume ...


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


4

This is actually quite well-detailed at this page. Please note that I am going to detail the common protocol introduced in version 1.7. Additionally, a new protocol was introduced in 1.9pre4 that contains additional information not found in the previous protocol. Let me detail how to get the basic server information in 1.7+: Send a "handshake" packet with ...


3

This game is a good example why you can't always automatically port a game from one platform to another. Having the player-character follow the mouse cursor works well when the user has a mouse, but most Android devices have no mouse, so a different input method needs to be used. In this game, the gameplay is tightly connected to the input method. This means ...


3

You can't just open the jar in Eclipse. Even if you have some kind of decompiler-plugin, you will only see obfuscated code. You will need the Minecraft Coder Pack to decompile and deobfuscate the jar (as well as MCP can anyway) so you can work with the code. Additionally, if you want do develop Minecraft-Forge mods you should check out this page. Forge ...


3

A common way to implement states and branching in a quest is through quest variables. I have witnessed this technique in many RPG titles from companies like Bioware or Bethesda. This is also what I am doing in my current project, and so far it works really well. Just add a script binding which allows scripts to store values in variables and later retrieve ...


2

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


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

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


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


1

If you're using velocities for this, the "jump distance" will be handled automatically. The distance on the X axis traveled during the jump is the product of the time in the air, and the X axis velocity. Say your jump takes one second to complete. If your character is traveling at 10 units per second on the X axis, during that one second jump, they will have ...


1

You should use BitmapFont.drawWrapped. public BitmapFont.TextBounds drawWrapped(Batch batch, java.lang.CharSequence str, float x, float y, float wrapWidth) All you need to do is set the wrapWidth variable as ...


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

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

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

Long term it might be better to create either monster classes that all inherit from a single monster class that contains all methods you need. Then each class can simply override these methods (make them abstract). That will be more scalable. A second good method is to create just 1 monster class and put the variables that monsters use in there (in this case ...


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 want to say, one of the other answers at the time of writing are suggesting "hard-coding" these events in your language. An alternative approach that can be pretty powerful is using an external format like XML, or a DSL (this is somewhat similar to the script binding approach) to define these events. Then you can easily an editor that outputs it. An ...


1

The only potential harm is to your power consumption, so don't do this on mobile devices. Conversely, quite a few embedded systems spend their entire lives in a loop waiting for things to happen. It used to be entirely normal to simply render game frames as fast as possible, sometimes without even a timer to compensate gameplay for different CPU speeds. ...


1

You shouldn't have jittery movement / gameplay There are two ways that you can implement game logic - tied to a real time, or tied to the number of "turns"/processing steps. If some thingy in your game is moving leftwards, will it's motion be different if your stepLogic() was called 100 instead of 50 times? If your code treats the elapsed time explicitly ...


1

Swapping the width and height in ShapeRenderer.rect should fix the problem, see the documentation.


1

Don,t do any thing just set the scale of the font and it will work for all type of device font.setScale( .9f,.9f);


1

To get the rotated sprites coordinate simply call the getVertices() method. For example: sprite.getVertices()[SpriteBatch.X2] Gets you the X coordinates of the top left corner. The same call but replacing X<number> with Y<number> gets you the Y coordinate. The corner numbers go like this: 2-3 | | 1-4


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