Tag Info

Hot answers tagged

4

Yes, generally, games are a single main loop. Games in Java may have a separate main loop for each menu/screen/mode due to Java's idioms, but that of course does not solve your animation wait problem. For things like the problem you are running into, consider using events. e.g., when your animation system finishes playing an animation, it can send out an ...


2

The constructor of your gameScreen class does not initialize the camera and renderer fields, what you're initializing in the show method are method-local variables with the same names. That's why they're null when you're in the render method. Try changing OrthogonalTiledMapRenderer renderer = new OrthogonalTiledMapRenderer(map,unitScale); ...


2

You require three things to load code from files and do things with the types and functions defined in those modules. A way to load a module from disk or memory. A way to, given a module, enumerate and use the functionality present in the module. A bunch of types and signatures designed to be shared between the modules, so the code has something to speak ...


1

You will need a zombie class. public class Zombie { public int x, y; public Entity(int x, int y) { this.x = x; this.y = y; } public void tick() { //code to control movement and such } public void render() { g.drawImage(zombieImage, x, y, null); } } I'm not sure which class you are showing in your code but you will need to make a zombie ...


1

Given that top left is at 0, and each tile is square with length 10: int squareClickedX = clickPosX / 10 int squareClickedY = clickPosY / 10 So, if clicked on x23, y12 int squareClickedX = 23 / 10 int squareClickedY = 12 / 10 results int squareClickedX = 2 int squareClickedY = 1 Means that you clicked Was this any good? This is quite common way ...


1

You can try calculating the surface normal using central finite differencing, and then colliding with a locally linear plane at the collision point. Vector2 GetNormal(Grid grid, int x, int y) { float dx = grid[x + 1, y] - grid[x - 1, y]; float dy = grid[x, y + 1] - grid[x, y - 1]; return Vector2(dx * 0.5f, dy * 0.5f); } When your grid is ...


1

Here is an official Spine 2D example where they load Spineboy into a game. https://github.com/EsotericSoftware/spine-superspineboy The following 3 lines are used to read a texture atlas and skeleton data as well as making some animation state data. TextureAtlas playerAtlas = new TextureAtlas(Gdx.files.internal("spineboy/spineboy.atlas")); SkeletonJson ...



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