Skip to content

Commit

Permalink
first release
Browse files Browse the repository at this point in the history
  • Loading branch information
hundun000 committed Nov 30, 2021
1 parent d8c369f commit 134b92b
Show file tree
Hide file tree
Showing 39 changed files with 198 additions and 65 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## custom
/desktop/save.json
/release-prepare/*
!/release-prepare/packr-config.json

## Java

Expand Down
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,41 @@

A clicker game.

Some bug can become an an industry.

Now You are a manager of a forest with bees. Gather some wood and wild bee as start. Build beehives which can generate bee, honey and beewax. Sell resources and products for coins. Finally, collect enough queen-bee for win-the-game!

### release

Download the zip. Use the win64 exe file, or the jar file.

### How to play

- Some constuctions are free. Click and gain its output.

![](./pic/1.jpg)

- Area-change-button is on the right border. Now we change to forest-area.

![](./pic/2.jpg)

- Some constuctions can swtich working-level by "+" / "-" button. Now we enable 1-level wood-selling and gain coins.

![](./pic/3.jpg)

- Upgrade other constuctions if your can afdord its upgrade-cost. And constuction only work if your can afdord its auto-work-cost.

![](./pic/4.jpg)

### Assert thanks

Audio:
https://opengameart.org/sites/default/files/Loop-Menu.wav
https://opengameart.org/sites/default/files/forest_0.mp3

image:
https://opengameart.org/content/backgrounds-3
// TODO more

text-generate:
https://cooltext.com/
Binary file removed core/assets/640x480.png
Binary file not shown.
Binary file added core/assets/bee-area.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 removed core/assets/cookie.png
Binary file not shown.
Binary file added core/assets/forest-area.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 modified core/assets/gameAreaIcons.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 core/assets/menu.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 core/assets/win.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions core/src/hundun/gdxgame/bugindustry/BugIndustryGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
import lombok.Getter;

public class BugIndustryGame extends Game {
public boolean debugMode = true;
public boolean drawGameImageAndPlayAudio = false;
public boolean debugMode = false;
public boolean drawGameImageAndPlayAudio = true;
public static int scale = 1;
public static final int LOGIC_WIDTH = 640;
public static final int LOGIC_HEIGHT = 480;
Expand Down
48 changes: 34 additions & 14 deletions core/src/hundun/gdxgame/bugindustry/model/GameDictionary.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,40 @@ public class GameDictionary {

public String constructionIdToShowName(ConstructionId constructionId) {
switch (constructionId) {
case WOOD_GATHER_HOUSE:
return "free wood";
case WOOD_KEEPING:
return "feller";
case BEE_GATHER_HOUSE:
return "free bee";
case SMALL_BEEHIVE:
return "small beehive";
case HONEY_SELL_HOUSE:
return "honey selling";
case HONEY_BUFF_PROVIDER:
return "honey gene";
default:
return "[dic:" + constructionId.name() + "]";

case WOOD_GATHER_HOUSE:
return "free wood";
case WOOD_KEEPING:
return "plate tree";
case WOOD_BOARD_MAKER:
return "board maker";
case WIN_THE_GAME:
return "win goal";

case BEE_GATHER_HOUSE:
return "free bee";
case SMALL_BEEHIVE:
return "small beehive";
case MID_BEEHIVE:
return "mid beehive";
case BIG_BEEHIVE:
return "big beehive";
case QUEEN_BEEHIVE:
return "queen beehive";

case WOOD_SELL_HOUSE:
return "sell wood";
case WOOD_BOARD_SELL_HOUSE:
return "sell board";
case BEE_SELL_HOUSE:
return "sell bee";
case HONEY_SELL_HOUSE:
return "sell honey";
case BEEWAX_SELL_HOUSE:
return "sell beewax";

default:
return "[dic:" + constructionId.name() + "]";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected void printDebugInfoAfterConstructed() {

@Override
public void onClick() {
if (!canUpgrade()) {
if (!canClickEffect()) {
return;
}
Map<ResourceType, Long> upgradeCostRule = modifiedUpgradeCostMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ public BaseClickGatherConstruction(BugIndustryGame game, ConstructionId id) {

@Override
public void onClick() {

if (!canClickEffect()) {
return;
}
game.getModelContext().getStorageManager().modifyAllResourceNum(modifiedOutputGainMap, true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ private void initWood() {
ResourceType.COIN, 25,
ResourceType.WOOD, 5
);
construction.setMAX_DRAW_NUM(15);
register(construction);
}
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public AchievementManager(BugIndustryGame game) {
}

private void initPrototypes() {
addPrototype(new AchievementPrototype("Game win", "Own 100 Honey",
addPrototype(new AchievementPrototype("Game win", "You win the game!",
null,
Map.of(ResourceType.WIN_TROPHY, 1)
));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@
import lombok.Getter;

public class TextureManager {
private Texture mainAreaBackgroundTexture;
private Texture beeAreaBackgroundTexture;
private Texture shopAreaBackgroundTexture;
private Texture forestAreaBackgroundTexture;
@Getter
private Texture winTexture;
@Getter
private Texture menuTexture;
private Map<ResourceType, TextureRegion> itemRegionMap = new HashMap<>();
private Map<ConstructionId, TextureRegion> constructionRegionMap = new HashMap<>();
private Map<GameArea, TextureRegion> gameAreaLeftPartRegionMap = new HashMap<>();
Expand All @@ -24,8 +29,11 @@ public class TextureManager {
TextureRegion defaultIcon;

public TextureManager() {
mainAreaBackgroundTexture = new Texture(Gdx.files.internal("640x480.png"));
beeAreaBackgroundTexture = new Texture(Gdx.files.internal("bee-area.png"));
shopAreaBackgroundTexture = new Texture(Gdx.files.internal("shop-area.png"));
forestAreaBackgroundTexture = new Texture(Gdx.files.internal("forest-area.png"));
winTexture = new Texture(Gdx.files.internal("win.png"));
menuTexture = new Texture(Gdx.files.internal("menu.png"));
this.beeTexture = new Texture(Gdx.files.internal("bee.png"));

{
Expand Down Expand Up @@ -78,8 +86,10 @@ public Texture getBackgroundTexture(GameArea gameArea) {
switch (gameArea) {
case SHOP:
return shopAreaBackgroundTexture;
case FOREST_FARM:
return forestAreaBackgroundTexture;
default:
return mainAreaBackgroundTexture;
return beeAreaBackgroundTexture;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package hundun.gdxgame.bugindustry.ui.component;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Touchable;
import com.badlogic.gdx.scenes.scene2d.ui.Button;
import com.badlogic.gdx.scenes.scene2d.ui.Container;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.SpriteDrawable;

import hundun.gdxgame.bugindustry.model.AchievementPrototype;
import hundun.gdxgame.bugindustry.ui.screen.GameScreen;
Expand All @@ -23,13 +26,13 @@ public class AchievementMaskBoard extends Table {

public AchievementMaskBoard(GameScreen parent) {
this.parent = parent;
this.setBackground(parent.maskBackgroundDrawable);
this.setBackground(new SpriteDrawable(new Sprite(parent.game.getTextureManager().getWinTexture())));
this.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

label = new Label("", parent.game.getButtonSkin());
this.add(label).center().row();

Button textButton = new TextButton("comfirm", parent.game.getButtonSkin());
Button textButton = new TextButton("continue", parent.game.getButtonSkin());
textButton.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
Expand All @@ -39,6 +42,7 @@ public void clicked(InputEvent event, float x, float y) {
this.add(textButton).center();

this.setVisible(false);

}
public void setAchievementPrototype(AchievementPrototype prototype) {
label.setText(prototype.getDescription());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class GameAreaControlBoard extends Table implements IGameAreaChangeListen
public static final int WIDTH = FULL_CELL_WIDTH;
public static final int Y = ConstructionControlBoard.BOARD_DISTANCE_TO_FRAME + ConstructionControlBoard.BOARD_HEIGHT + 5;
static final int HEIGHT = Gdx.graphics.getHeight() - (StorageInfoBoard.BOARD_DISTANCE_TO_FRAME_TOP + StorageInfoBoard.BOARD_HEIGHT) - Y;
public static final int X = Gdx.graphics.getWidth() - WIDTH - 5;
public static final int X = Gdx.graphics.getWidth() - WIDTH;

public GameAreaControlBoard(GameScreen parent) {
super();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,10 @@ public void drawAll() {
gameEntityFactory.checkRandomeMoveSpeedChange(entity);
positionChange(entity);

parent.game.getBatch().draw(entity.getTexture(), entity.getX(), entity.getY(), entity.getDrawWidth(), entity.getDrawHeight());
parent.game.getBatch().draw(entity.getTexture(), entity.getX(), entity.getY(), (entity.isTextureFlipX() ? -1 : 1) * entity.getDrawWidth(), entity.getDrawHeight());

});
}



parent.game.getBatch().end();
}
Expand Down Expand Up @@ -110,7 +108,7 @@ public void onResourceChange(boolean fromLoad) {
private void checkBeeEntityList() {
ResourceType type = ResourceType.BEE;
long resourceNum = parent.game.getModelContext().getStorageManager().getResourceNum(type);
int drawNum = (int) Math.min(MAX_DRAW_BEE_NUM, resourceNum > 0 ? Math.ceil(Math.log(resourceNum)) : 0);
int drawNum = (int) Math.min(MAX_DRAW_BEE_NUM, resourceNum);

Queue<GameEntity> gameEntities = beeQueue;
while (gameEntities.size() > drawNum) {
Expand All @@ -128,7 +126,7 @@ private void checkBeeEntityList() {
private void checkEntityList(ConstructionId type) {
BaseConstruction construction = parent.game.getModelContext().getConstructionFactory().getConstruction(type);
int resourceNum = construction.getSaveData().getWorkingLevel();
int drawNum = (int) Math.min(construction.getMAX_DRAW_NUM(), resourceNum > 1 ? Math.ceil(Math.log(resourceNum)) : resourceNum);
int drawNum = (int) Math.min(construction.getMAX_DRAW_NUM(), resourceNum);
gameEntitiesOfTypes.computeIfAbsent(type, k -> new ConcurrentLinkedQueue<>());
Queue<GameEntity> gameEntities = gameEntitiesOfTypes.get(type);
while (gameEntities.size() > drawNum) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public PopupInfoBoard(GameScreen parent) {
private <T extends Actor> Container<T> wapperContainer(T content) {
Container<T> container = new Container<T>(content);
container.setBackground(parent.tableBackgroundDrawable);
container.fill(true);
return container;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*/
public class StorageInfoBoard extends Table {

public static int BOARD_DISTANCE_TO_FRAME_TOP = 50;
public static int BOARD_DISTANCE_TO_FRAME_TOP = 10;
public static int BOARD_DISTANCE_TO_FRAME_SIDE = 10;
public static int BOARD_HEIGHT = 60;
private static int NODE_HEIGHT = 25;
Expand Down Expand Up @@ -78,7 +78,9 @@ public StorageInfoBoard(GameScreen parent) {

initData();
rebuildCells();
this.debug();
if (parent.game.debugMode) {
this.debugAll();
}
}


Expand Down
Loading

0 comments on commit 134b92b

Please sign in to comment.