Skip to content

Commit

Permalink
update hexCell image
Browse files Browse the repository at this point in the history
  • Loading branch information
hundun000 committed Sep 10, 2023
1 parent 2879b5c commit 6263050
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
Binary file modified IdleDemo-game/core/assets/CellIcons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added IdleDemo-game/core/assets/raw/hex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added IdleDemo-game/core/assets/raw/hex_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ public void lazyInitOnGameCreateStage2() {
}
{
Texture texture = new Texture(Gdx.files.internal("CellIcons.png"));
TextureRegion[][] regions = TextureRegion.split(texture, 675, 733);
TextureRegion[][] regions = TextureRegion.split(texture, 128, 128);
defaultAreaBack = regions[0][1];
constructionHexImageMap.put(ConstructionPrototypeId.EMPTY_CELL, regions[0][0]);
constructionHexImageMap.put(ConstructionPrototypeId.COOKIE_CLICK_PROVIDER, regions[1][0]);
constructionHexImageMap.put(ConstructionPrototypeId.COOKIE_AUTO_PROVIDER, regions[1][3]);
constructionHexImageMap.put(ConstructionPrototypeId.COOKIE_AUTO_SELLER, regions[2][1]);
constructionHexImageMap.put(ConstructionPrototypeId.COOKIE_CLICK_PROVIDER, regions[0][1]);
constructionHexImageMap.put(ConstructionPrototypeId.COOKIE_AUTO_PROVIDER, regions[0][2]);
constructionHexImageMap.put(ConstructionPrototypeId.COOKIE_AUTO_SELLER, regions[0][3]);
//gameAreaBackMap.put(GameArea.AREA_WIN, regions[0][3]);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@


public class HexCellVM extends Table {

static int HEX_SIZE = 128;
static float hexBaseSizeX = (float) (HEX_SIZE * Math.sqrt(3.0f) / 2);
static float hexBaseSizeY = (float) (HEX_SIZE * 0.75);
DemoIdleGame game;

HexAreaVM hexAreaVM;
Expand All @@ -33,8 +35,8 @@ public HexCellVM(WorldPlayScreen parent, HexAreaVM hexAreaVM, BaseConstruction d
image.setBounds(
0,
0,
hexAreaVM.screen.getLayoutConst().DESK_WIDTH,
hexAreaVM.screen.getLayoutConst().DESK_HEIGHT
hexBaseSizeX,
HEX_SIZE
);
this.addActor(image);
/*this.setBackground(new TextureRegionDrawable(new TextureRegion(TextureFactory.getSimpleBoardBackground(
Expand All @@ -58,17 +60,17 @@ public void updateUI(){
this.setBounds(
uiPosition.x,
uiPosition.y,
hexAreaVM.screen.getLayoutConst().DESK_WIDTH,
hexAreaVM.screen.getLayoutConst().DESK_HEIGHT
hexBaseSizeX,
HEX_SIZE
);
}

private static Vector2 calculatePosition(int gridX, int gridY)
{
float hexBaseSize = 100;

Vector2 newposition = new Vector2(0, 0);
newposition.y += hexBaseSize * 0.75f * gridY;
newposition.x += hexBaseSize * Math.sqrt(3.0f) / 2 * (gridX - (Math.abs(gridY) % 2) / 2.0f);
newposition.y += hexBaseSizeY * gridY;
newposition.x += hexBaseSizeX * (gridX - (Math.abs(gridY) % 2) / 2.0f);
return newposition;
}

Expand Down

0 comments on commit 6263050

Please sign in to comment.