# ben berizovsky

Member

3

0 Neutral

• Rank
Newbie

• Interests
Design
Programming

• Github
benberi
1. ## [Java] LibGDX Isometric map - movement of an entity

I noticed that if I do the movement simply y += 0.1f on screen coordinates, and convert to isometric, it works great!
2. ## [Java] LibGDX Isometric map - movement of an entity

Hello there!, thank you for your reply. I'd like to state that the movement speed is not something that a user can control. User clicks on a button "forward" and that moves the ship a block forward, with motion. Take a look at this video: I am building a simulator for the exact game. Basically at the end of this project of mine, I want to approach movements like in this video. I have all sprite rotations packed in an orientations object, that I just can increment the index to go to the next rotation. But I really want to start with the forward, it is very simple compared to left/right movements. Move a ship from local position to target position. This sounds easy, but I really have a problem seeing it in isometric map, while on a flat map you simply just increase X or Y only, but there you have to move a little in x, and a little in y every time. So my question is, how exactly? I am b
3. ## 2D [Java] LibGDX Isometric map - movement of an entity

Hello there, I am new to the forum and in game development in general! I am currently building a simulator for some game, and I am having a few problems already, and I am using the libgdx framework. I have an isometric map drawn, where each tile is a spot that only one entity can be at. An entity can either move left, right or just forward in a straight line. Now this is what it looks at the moment: As you can see, my ship entity is located at 1,1. I want to start with adding a function that moves the ship in a straight line, so I need to move this ship to 1,2. So I have a Vector2 that represents the ship's position, I made a dummy one in the local class where it paints entities, and the map and it's set to isometric coordinates of 1,1: r = new TextureRegion(texture, location.getX(), location.getY(), location.getWidth(), location.getHeight()); local = new Vector2(getIsometricX(1,1, r), getIsometricY(1,1, r)); "r" is my texture region, which is my sprite image off the spritesheet. Now I have set a target position to 1,2: target = new Vector2(getIsometricX(1,2, r), getIsometricY(1,2, r)); So now my question is, how can I make that ship move to the target position? If i add 1 to x and y every tick, it will just move too much to the right. This is how I paint everything: @Override public void render() { batch.setProjectionMatrix(camera.combined); batch.begin(); // Render the map renderSeaBattle(); // Render ships renderEntities(); batch.end(); } And the map painting: private void renderSeaBattle() { // The map tiles GameTile[][] tiles = map.getTiles(); for (int i = 0; i < tiles.length; i++) { for(int j = 0; j < tiles.length; j++) { GameTile tile = tiles[j]; Texture texture = tile.getTexture(); int x = (i * GameTile.TILE_WIDTH / 2) - (j * GameTile.TILE_WIDTH / 2) -texture.getWidth() / 2; int y = (i * GameTile.TILE_HEIGHT / 2) + (j * GameTile.TILE_HEIGHT / 2) -texture.getHeight() / 2; batch.draw(texture, x, y); } } } And the entities: private void renderEntities() { batch.draw(r, local.x + location.getOffsetx(), local.y + location.getOffsety()); } location is an instance that contains the offset position for that specific sprite, because not all sprites are the same size, so to center it on the tile, each one has set offsetX and Y. And this is my coordinate conversion methods: public int getIsometricX(int x, int y, TextureRegion region) { return (x * GameTile.TILE_WIDTH / 2) - (y * GameTile.TILE_WIDTH / 2) - (region.getRegionWidth() / 2); } public int getIsometricY(int x, int y, TextureRegion region) { return (x * GameTile.TILE_HEIGHT / 2) + (y * GameTile.TILE_HEIGHT / 2) - (region.getRegionHeight() / 2); } After I do the straight line, how can I create left/right movements in curves? Thanks!