John
  • Member for 7 years, 1 month
  • Last seen more than a week ago
Handling multiple controllers in a single player game
Accepted answer
3 votes

TL;DR - Ideally you should allow all controllers to open up your game's options menu and select the "Primary" controller (which can be defaulted to the first controller you see). That controller is ...

View answer
Collision detection with Java streams and access of collisionable objects
2 votes

And are there good resources on collision detection for Java(8)? TL;DR- when dealing with collisions, you're almost always better off using 3rd party engines like Box2D which is compatible with ...

View answer
How would you handle different level-types in an entity-component-system?
2 votes

I don't think there is a completely correct answer to a question like this, but I'll take my best shot at it. As I'm sure you know, one of the key ideas behind the entity-component architecture is ...

View answer
How can I clean this if Statement up?
2 votes

Making it more efficient (saving CPU cycles) will be a matter of making sure you only call this chunk of code when hp changes. That being said, you can easily simplify this to five lines of code: hp1....

View answer
LibGDX - Rectangle Collision and Response
2 votes

Detecting a collision between two rectangles is relatively straightforward- if they overlap, they collide. libGDX provides this as part of the Rectangle.overlap() method: public boolean overlaps (...

View answer
Can someone explain me how rayCast works?
2 votes

Raycasting is when we draw an invisible line through space and see what it intersects with. A common use for this is to figure out what a player is clicking on- we draw a line from the camera in the ...

View answer
How to manage changing Z-Index in an Entity-Component-System?
Accepted answer
1 votes

I'm going to agree with @Sidar in the comments- this probably isn't an issue, and I don't see a better implementation given the libraries you're using. If you look at the Ashley/libGDX implementation,...

View answer
Autoscroll a TextArea to youngest/freshest row/line
1 votes

I had a similar situation in a game I was working on, and what I ended up doing was putting the TextArea in a ScrollPane and then adding an action with each line to scroll it to the bottom (there ...

View answer
How do you create an over world styled like Pokémon Black and White, with both 2D and 3D elements?
1 votes

If I understand what you're asking for, sort of a "cardboard cutout" effect for the characters, then what you'd do is build your "Overworld" as a 3D world and draw your characters on quads (planes).

View answer
Box2D in 3D space
1 votes

It should be pretty much the same as if you were using sprites. I would just keep it simple and say that one Box2D meter is one game unit.

View answer
How PhysicsBodyLoader.SCALE of overlap2d runtime works?
1 votes

From looking at the source code, it appears to be used to help translate between "pixel units" and "world units". [EDIT] [Xoppa's article]1 explains it rather well, but "pixel units" is the number of ...

View answer
(Pacman) Loading 151 dots (picturebox) in form. What's the easy way?
1 votes

The short answer is that I think your code is on the right track, although knowing PACMAN I don't think you'll be able to set the positions in a loop because they're not based on a predictable pattern-...

View answer
Framerate-independent game loops and discrete tasks
Accepted answer
1 votes

I typically use a variation of #2 where I keep track of the amount of time since the task was last executed, and then subtract the interval as shown in the pseudo-code below: private float ...

View answer
Coordinate in LibGDX?
Accepted answer
1 votes

When you call ExtendViewport#update(), you're not passing the third parameter (like the tutorial does), so it is centering the camera on 0,0 instead of positioning the camera so that 0,0 is in the ...

View answer
How to switch screens when a button is pressed? LibGDX
1 votes

Welcome to Stack Exchange! A good reference for you to look at would be the libGDX wiki. Chances are it will answer 80% of your questions. Its "A Simple Game" tutorial and "Extending the Simple Game" ...

View answer
Actor in Stage Does Not Update the MoveTo XY Location
1 votes

I think the problem is because you are calling this.act(delta) in your ArrowClass' draw method. When you call Stage#act(), it will call the act method on all of its actors for you. Since you're ...

View answer
LibGDX - how to close game and dispose objects properly
1 votes

The problem is because you're trying to dispose of the Stage while you're still inside the clicklistener, and it isn't done processing yet. Instead of trying to quit at that point, I would set a ...

View answer
(LIBGDX) args instead of variables names
Accepted answer
1 votes

I'm not an expert, but I believe the problem is that you're only including the binaries, so your IDE can't figure out what the original variable names were. If you include the source code as well, ...

View answer
LibGDX: Shape from ShapeRenderer won't show up when put in another class
Accepted answer
1 votes

In your Border constructor you never assign x, y, width, or height to local variables, which means they all default to 0. Once I added those assignments the rest of the code worked fine for me.

View answer
Box2D - World step on Android game using LibGDX
Accepted answer
0 votes

So let's take a look at what each of those code examples are doing: world.step(1f/60f, 6, 2); Example #1 tells the physics engine that 1/60th of a second has passed every time you call it. If your ...

View answer
Libgdx: touchup fired even when figure not on texture
0 votes

Oddly enough, the documentation for InputListener appears to be a little different than the source. If you look at the source for InputListener, it's actually behaving as it's supposed to: /** Called ...

View answer
Use Ashley with Scene2d in libGDX?
Accepted answer
0 votes

I don't think you can say it's always a bad idea to mix Scene2D and an ECS like Ashley. It may make a lot of sense to use Scene2D.UI for your user interface, and then Ashley for everything else. As ...

View answer
libgdx scene2d DelayAction and SequenceAction
Accepted answer
0 votes

When creating a SequenceAction, the order of parameters matters. Your code is telling it to scale, then move, then delay. Since delay is the last action, it doesn't really do anything.

View answer
What are the differences between using GetComponent<Transform>() and this.transform?
0 votes

Right now you can assume that every game object will have the Transform component due to the this.transform syntax. My guess is that Unity updated its API with the GetComponent<>() syntax was so ...

View answer