Tag Info

Hot answers tagged

18

Storing the completion information in a local file is a simple and perfectly acceptable method of doing so. Fundamentally, this is what every game will do to track progress (in some fashion, although the specific formats used for the data and the storage mechanism will differ). Protecting the file from tampering is more difficult. If there's no compelling ...


10

The PNG files are small because they are compressed. When the images are loaded into memory they are uncompressed and therefore take up more space.


9

You can create a replay file as proof of work while the player is playing. Start the game, save the starting conditions including the name of the level and the pseudorandom seed, record the exact timestamped input states (mouse movements, key or button presses, etc.) that your game's input layer passes to its logic layer, and stop recording once the ...


8

Here's a vector-based solution. I haven't tried it, but it seems fine conceptually. Theory I gather you've stored the shape as line segments. Here's the letter A represented with three line segments. I've assumed that paths in the user's drawing are stored as lists of points. We can "inflate" those line segments to allow an error margin when checking ...


8

TextureAtlas#findRegion(String) returns a region with a name that matches the name specified. It does not copy the region, therefore any changes you make to the region will be reflected in the TextureAtlas. To overcome this issue, simply instantiate a new TextureRegion object and pass it the region found inside your TextureAtlas: background1 = new ...


5

It's because you're doing integer math in the first case, but not in the second. First, a quick look at the documentation getWidth int getWidth() Returns: the width in pixels of the display surface. < getHeight int getHeight() Returns: the height in pixels of the display surface So now we know that the two methods return integer ...


5

What's happening First of all, note that this behavior is not specific to oblique collisions. Below is an example of two balls colliding head on with a wall. All fixtures have m_restitution = 1.0, and m_friction = 0.0. The ball on the left is traveling with v = 0,1 and the ball on the right has v = 0,1.01. I found three similar questions asked on the ...


5

Sarting with the clouds, a simple method is to draw them as three layers: Layer 1 is the bottom layer, and is drawn first. It just contains the cyan background. Layer 2 is the middle layer, drawn between the other two, and it represents the 3D highlights. The background in this layer would again be transparent (represented by a purple colour in the ...


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

The artifacts are caused by scaling the images using point sampling / nearest neighbourhood filtering, which effetively doubles some of the pixels from the original image. To get better results, switch to bilinear filtering which uses weighed average of multiple pixels. The result will be a little blurry, but should look a lot better than the current one. ...


4

Alpha mask texture approach In case your circle would always be the same size, using a second alpha mask texture would be the way to go. You would make it a grayscale mask texture and use its value as the alpha value while drawing. Using a texture had the benefit of having anti-aliasing built into the mask (ie. at the borders of your circle, the pixels can ...


4

There are several different options for handling what you are attempting: These are not all or nothing solutions, you can mix and match them to balance the workload between programming and creating animations. Option 1 Can be used on a case by case basis. Obscure it. The transition between animation states can simply be hidden behind various effects. Blood ...


4

The problem you are facing is conversion between two different coordinates systems: the graphical one and the input one. Graphics coordinates Like you said, libGDX uses a 1 to 1 ratio between space coordinates and pixels, and starts in the bottom left corner. But it can be anything, really. That is just the default behavior of libGDX. You could change the ...


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

From LibGDX's docs: spriteBatch.draw(Texture texture, float x, float y, float width, float height, int srcX, int srcY, int srcWidth, int srcHeight, boolean flipX, boolean flipY) Draws a rectangle with the bottom left corner at x,y having the given width and height in pixels. Set flipX as true to get your desired result


3

Your pathfinding should return a list of way points to reach your objective for each unit. Since you are making a turn based game, I am assuming that the unit movement is like a chess piece. It is either on "this" tile or "that tile, and not in between. If this is the case you might end up with the scenario where a units movements runs out in the middle of ...


3

The question is a little stale, but in case it still helps: After you run ./gradlew html:dist to generate production code, you want to copy everything inside ./html/build/dist/ to your server. Running that command produces the code in that directory. The code that's under the war directory and that has a Tomcat-like structure, I believe all that is for ...


3

Change your thought process from "Moving 7 units" to "Applying a velocity of 7 units" and you can come up with something like: velocity.Y = -7; position.Y += velocity.Y; Now if we take this and we want to apply acceleration every frame we can simply update the velocity every frame. accelerationRate = 2; //arbitrarily picked - no significance velocity.Y = ...


3

I figured it out, hope this helps someone someday :) Using the normal LibGDX approach, create a project using File -> Import -> Gradle (gradle build). Highlight all of the project folders and right click -> team -> share project Note: SVN does not support adding multiple folders at once, make sure to click 'Share Project' option. Enter repo URL: (I just ...


3

glClearColor expects color values to be in 0 .. 1 range, everything outside of this range gets clamped to it. In your case numbers are getting clamped to (1, 1, 0, 0) which is indeed yellow. Try setting glClearColor(60/255.0, 181/255.0, 0.0, 0.0); instead.


3

You can call .setText("Some String"); on your label in your Render-method.


3

It means desktop. You have two options to deploy your libGDX app to the desktop: Create a self-runnable JAR. This is easier (Eclipse can export it pretty easily). Create an EXE, via launch4j (or some other wrapper). This is possible too (especially with Gradle). I've used both approaches and they work equally well as far as I can tell. Both rely on ...


3

Found the answer, instead of the static Table.drawDebug(stage); call there is an instance method called stage.setDebug().


3

First ensure that your Actors are able to report their bounds: public class Enemy extends Actor { Rectangle bounds; public Enemy() { bounds=new Rectangle((int)getX(), (int)getY(), (int)getWidth(), (int)getHeight()); } public Rectangle getBounds() { return bounds; } private void setXY(float pX,float pY) { ...


3

Track the elapsed time in your Screen, then when a limit is reach as the Game instance to swap to your next screen; public class MyScreen extends ScreenAdapter { private final Game game; private float elapsed; public MyScreen(final Game game) { this.game = game; } public void render(float delta) { elapsed += delta; // Render or ...


3

The most effective way to improve collision check speed is to decrease the number of entities that needs to be checked against. Spatial partitioning such as octree helps but you can make further improvements. Suppose if currently you have one big list of collidables contains objects and bullets and in each collision check step you are looping through all ...


3

Yet having these 3500 sleeping static bodies degrades performance to such a degree that even when running the game on my MacBook Pro 2012 in a Genymotion emulator, I get about 5 FPS. As Anko said in his comment, you shouldn't be guessing about whether this is Box2D or rendering or something else. Measure what's taking all the frame time. Use a profiler ...


3

There's no real benefit to sorting those sprites by not-Pokemon index; the texture packer doesn't care what order the not-Pokemon are in, it cares about minimizing the atlas size. I'd just let it do its thing, the atlas file already specifies the position, dimensions, and other settings for each sprite. All you have to do is reference them by name.


3

Creating the glitchy look can be accomplished in a broad spectrum of ways. In essence, what we have been culturally accustomed to accept as a glitch is everything that is a sudden distortion of what would otherwise be coherent content. Some glitches fit well with analogue transmission (i.e white noise) and others fit well with digital displays, random ascii ...


3

With a camera you separate your game measurements from the screen size and ratio. It is not always better. If you make a board game for example, you can just fit it to the width of the screen, the view will never move anyway. When using pixels to measure, you have no floating point positions. By the way i made a full pong like game without a camera. I ...



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