Skip to content

Commit

Permalink
Merge branch 'master' of github.com:TeamDogeDev/LD38
Browse files Browse the repository at this point in the history
# Conflicts:
#	core/src/de/dogedev/ld38/ashley/systems/AiSystem.java
#	core/src/de/dogedev/ld38/screens/GameScreen.java
  • Loading branch information
dasfuu committed Apr 24, 2017
2 parents 205c8a6 + 467c22e commit a4a5707
Show file tree
Hide file tree
Showing 17 changed files with 61 additions and 41 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
#LD 38
# Tiny Battlehex

meisterfuu's and elektropapst's entry for LudumDare Jam 38

[Learn how to play this game](howtoplay/howtoplay.md)

### Have fun :)
4 changes: 2 additions & 2 deletions core/src/de/dogedev/ld38/ashley/systems/AiSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public class AiSystem extends IntervalSystem {
private ImmutableArray<Entity> fields;
private ImmutableArray<Entity> spawns;

public AiSystem(GameScreen gameScreen) {
super(Statics.settings.aiTickRate);
public AiSystem(GameScreen gameScreen, int priority) {
super(Statics.settings.aiTickRate, priority);
this.gameScreen = gameScreen;
}

Expand Down
3 changes: 2 additions & 1 deletion core/src/de/dogedev/ld38/ashley/systems/CameraSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ public class CameraSystem extends EntitySystem {
private final OrthographicCamera camera;


public CameraSystem(OrthographicCamera camera) {
public CameraSystem(OrthographicCamera camera, int priority) {
super(priority);
this.camera = camera;
}

Expand Down
3 changes: 2 additions & 1 deletion core/src/de/dogedev/ld38/ashley/systems/DebugUISystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public class DebugUISystem extends EntitySystem implements Disposable {
private OrthographicCamera camera;
private DecimalFormat floatFormat = new DecimalFormat("#.##");

public DebugUISystem(OrthographicCamera camera) {
public DebugUISystem(OrthographicCamera camera, int priority) {
super(priority);
this.camera = camera;
font = Statics.asset.getBitmapFont(BitmapFonts.KENNEY_1);
GLProfiler.enable();
Expand Down
4 changes: 2 additions & 2 deletions core/src/de/dogedev/ld38/ashley/systems/FinishSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
public class FinishSystem extends IntervalSystem {
private ImmutableArray<Entity> entities;

public FinishSystem() {
super(Statics.settings.finishCheckInterval);
public FinishSystem(int priority) {
super(Statics.settings.finishCheckInterval, priority);
}

@Override
Expand Down
3 changes: 2 additions & 1 deletion core/src/de/dogedev/ld38/ashley/systems/GridSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public void addedToEngine(Engine engine) {
private OrthographicCamera camera;
private BitmapFont font;

public GridSystem(OrthographicCamera camera) {
public GridSystem(OrthographicCamera camera, int priority) {
super(priority);
this.camera = camera;
font = Statics.asset.getBitmapFont(BitmapFonts.KENNEY_1);
fontbg = Statics.asset.getTextureAtlasRegion(Key.ICONS_TEXTBG);
Expand Down
3 changes: 2 additions & 1 deletion core/src/de/dogedev/ld38/ashley/systems/InputSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ public class InputSystem extends EntitySystem {
private final InputMultiplexer inputMultiplexer;
private GameScreen gameScreen;

public InputSystem(OrthographicCamera camera, GameScreen gameScreen) {
public InputSystem(OrthographicCamera camera, GameScreen gameScreen, int priority) {
super(priority);
this.camera = camera;
inputMultiplexer = new InputMultiplexer(
new GameInputProcessor(camera),
Expand Down
3 changes: 2 additions & 1 deletion core/src/de/dogedev/ld38/ashley/systems/LegendUISystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public class LegendUISystem extends EntitySystem implements Disposable {

private float xSpacing = 5;
private float ySpacing = 10;
public LegendUISystem() {
public LegendUISystem(int priority) {
super(priority);
font = Statics.asset.getBitmapFont(BitmapFonts.KENNEY_1);

beigeBuilding = Statics.asset.getTextureAtlasRegion(Key.OBJECTS_BEIGEBUILDING);
Expand Down
3 changes: 2 additions & 1 deletion core/src/de/dogedev/ld38/ashley/systems/MapRenderSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ public class MapRenderSystem extends EntitySystem {
private final OrthographicCamera camera;
private HexagonalTiledMapRenderer renderer;

public MapRenderSystem(OrthographicCamera camera, TiledMap map) {
public MapRenderSystem(OrthographicCamera camera, TiledMap map, int priority) {
super(priority);
this.camera = camera;
renderer = new HexagonalTiledMapRenderer(map);
}
Expand Down
24 changes: 12 additions & 12 deletions core/src/de/dogedev/ld38/ashley/systems/MovementSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,43 +10,43 @@
/**
* Created by Furuha on 28.01.2016.
*/
public class MovementSystem extends EntitySystem {
public class MovementSystem extends EntitySystem {


private ImmutableArray<Entity> entities;
private ImmutableArray<Entity> spawns;

public MovementSystem() {

public MovementSystem(int priority) {
super(priority);
}

@Override
public void addedToEngine (Engine engine) {
public void addedToEngine(Engine engine) {
entities = engine.getEntitiesFor(Family.all(PositionComponent.class, MovementComponent.class, PeepComponent.class).get());
spawns = engine.getEntitiesFor(Family.all(SpawnComponent.class, PlayerComponent.class).get());
}

@Override
public void removedFromEngine (Engine engine) {
public void removedFromEngine(Engine engine) {

}

Vector2 current = new Vector2();
Vector2 target = new Vector2();

@Override
public void update (float deltaTime) {
for(Entity e: entities){
public void update(float deltaTime) {
for (Entity e : entities) {
MovementComponent mvc = ComponentMappers.movement.get(e);
PositionComponent pvc = ComponentMappers.position.get(e);
PeepComponent peep = ComponentMappers.peep.get(e);
current.set(pvc.x, pvc.y);
target.set(mvc.x, mvc.y);
target.sub(current);

if(target.len() < 40){
if (target.len() < 40) {
// Einheit ist angekommen
e.add(((PooledEngine)getEngine()).createComponent(HiddenComponent.class));
e.add(((PooledEngine) getEngine()).createComponent(HiddenComponent.class));
e.remove(MovementComponent.class);
Vector2 tilePos = CoordinateMapper.getTile((int) pvc.x, (int) pvc.y);
getEngine().getSystem(GridSystem.class).incAt(
Expand All @@ -58,16 +58,16 @@ public void update (float deltaTime) {

float speed = 50;

for(Entity spawn: spawns){
for (Entity spawn : spawns) {
PlayerComponent playerComponent = ComponentMappers.player.get(spawn);
if(playerComponent != null && playerComponent.player == peep.player){
if (playerComponent != null && playerComponent.player == peep.player) {
speed += ComponentMappers.spawn.get(spawn).movementSpeed;
}

}

target.nor();
target.scl(speed*deltaTime);
target.scl(speed * deltaTime);
pvc.x += target.x;
pvc.y += target.y;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public class OverlayRenderSystem extends EntitySystem implements Disposable {
private Vector3 mouse = Vector3.Zero;
private Vector2 arrowTilePosition;

public OverlayRenderSystem(OrthographicCamera camera) {
public OverlayRenderSystem(OrthographicCamera camera, int priority) {
super(priority);
this.camera = camera;
spriteBatch = new SpriteBatch();
arrowTilePosition = new Vector2(0, Statics.settings.tilesY-1);
Expand Down
3 changes: 2 additions & 1 deletion core/src/de/dogedev/ld38/ashley/systems/RenderSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public class RenderSystem extends EntitySystem implements EntityListener {
private BitmapFont font;
ImmutableArray<Entity> entities;

public RenderSystem(OrthographicCamera camera) {
public RenderSystem(OrthographicCamera camera, int priority) {
super(priority);
this.camera = camera;
this.batch = new SpriteBatch();
this.sortedEntities = new Array<>();
Expand Down
3 changes: 2 additions & 1 deletion core/src/de/dogedev/ld38/ashley/systems/TickSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public class TickSystem extends EntitySystem {
private ImmutableArray<Entity> spawns;
private ImmutableArray<Entity> buildings;

public TickSystem() {
public TickSystem(int priority) {
super(priority);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion core/src/de/dogedev/ld38/assets/GameSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class GameSettings {

public int numBuildings = (int) ((tilesX*tilesY)*.4);
public float difficulty = .4f; // 0 = easy peasy; 1 = "super hard"
public float aiTickRate = 0.1f;
public float aiTickRate = 0.2f;

public float finishCheckInterval = 1;
// effects
Expand Down
26 changes: 13 additions & 13 deletions core/src/de/dogedev/ld38/screens/GameScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,24 @@ public GameScreen() {

TiledMap map = mapBuilder.buildMap(settings.tilesX, settings.tilesY);

mapRenderSystem = new MapRenderSystem(camera, map);
renderSystem = new RenderSystem(camera);



ashley.addSystem(new InputSystem(camera, this));
ashley.addSystem(new CameraSystem(camera));
ashley.addSystem(new MovementSystem());
ashley.addSystem(new AiSystem(this));
ashley.addSystem(new InputSystem(camera, this, 1));
ashley.addSystem(new CameraSystem(camera, 1));
ashley.addSystem(new MovementSystem(2));
ashley.addSystem(new AiSystem(this, 3));

mapRenderSystem = new MapRenderSystem(camera, map, 4);
ashley.addSystem(mapRenderSystem);
renderSystem = new RenderSystem(camera, 5);
ashley.addSystem(renderSystem);
// ashley.addSystem(new DebugUISystem(camera));
ashley.addSystem(new TickSystem());
ashley.addSystem(new OverlayRenderSystem(camera));
ashley.addSystem(new GridSystem(camera));
ashley.addSystem(new FinishSystem());
ashley.addSystem(new LegendUISystem());
// ashley.addSystem(new DebugUISystem(camera, 6));
ashley.addSystem(new TickSystem(7));
ashley.addSystem(new OverlayRenderSystem(camera, 8));
ashley.addSystem(new GridSystem(camera, 9));
ashley.addSystem(new FinishSystem(10));
ashley.addSystem(new LegendUISystem(11));


dirtyEntities = ashley.getEntitiesFor(Family.all(DirtyComponent.class).get());
Expand Down Expand Up @@ -270,7 +271,6 @@ public void render(float delta) {
ashley.removeEntity(entity);
}
}

}

@Override
Expand Down
7 changes: 6 additions & 1 deletion howtoplay/howtoplay.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ As already mentioned above, capturing tiles with buildings can boost you:
* `maxpopulation` = Maximum amount of warriors in the Hex Castle spawn
* `tickrate` = How fast the warrior spawn ticks

Fortunately we can see a legend located at the window's bottom border, so we don't need to remember all buildings and their effects:

![legend][Legend]

## Goal

It is as simple as it sounds:
Expand Down Expand Up @@ -108,4 +112,5 @@ We are incredibly thankful for the assets from:
[any]: all.png "dirt"

[start]: start.png "Start"
[steps]: start2.png "Steps"
[steps]: start2.png "Steps"
[legend]: legend.png "Legend"
Binary file added howtoplay/legend.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a4a5707

Please sign in to comment.