Skip to content
Snippets Groups Projects
Commit 3dddbb7b authored by ODL guest ODL guest's avatar ODL guest ODL guest
Browse files

Merge branch 'master' of git.fossgalaxy.com:ce810/ggj2017

parents 6a250e48 96d5b32b
No related branches found
No related tags found
No related merge requests found
......@@ -48,8 +48,7 @@ public class MoveAction implements GameAction {
Area area = new Area();
range.forEach(h -> {
Entity e = s.getEntityAt(h.getCubeCoordinate());
if (e != null) {
if (!isPossible(actor, s, h.getCubeCoordinate())) {
return;
}
......@@ -66,6 +65,26 @@ public class MoveAction implements GameAction {
}
@Override
public boolean isPossible(Entity entity, GameState s, CubeCoordinate co) {
//movement is not possible if the space is occupied
Entity e = s.getEntityAt(co);
if (e != null) {
return false;
}
//movement is not possible if it's too far away
int movementDist = entity.getType().getMovement();
if (movementDist < s.getDistance(entity.getPos(), co)) {
return false;
}
//movement might not be possible
return isPossible(entity);
}
@Override
public Order generateOrder(CubeCoordinate co, GameState s) {
return new DroneMovement(co);
......
......@@ -6,6 +6,7 @@ import java.awt.Graphics2D;
import java.awt.Shape;
import java.awt.Stroke;
import java.awt.geom.Area;
import java.awt.image.BufferedImage;
import java.util.Collection;
import java.util.List;
......@@ -15,6 +16,7 @@ import org.codetome.hexameter.core.api.Hexagon;
import com.fossgalaxy.games.rts.GameState;
import com.fossgalaxy.games.rts.entity.Entity;
import com.fossgalaxy.games.rts.entity.HexagonTile;
import com.fossgalaxy.games.rts.io.SpriteRegistry;
import com.fossgalaxy.games.rts.order.AttackOrderRanged;
import com.fossgalaxy.games.rts.order.MoveOrder;
import com.fossgalaxy.games.rts.order.Order;
......@@ -31,6 +33,17 @@ public class RangeAttackAction implements GameAction {
return;
}
if (!JamApp.isZoneOfControl(s, actor)) {
SpriteRegistry sr = SpriteRegistry.INSTANCE;
BufferedImage img = sr.getImage("ui/no-signal");
Hexagon<HexagonTile> ht = s.cube2hex(actor.getPos());
g.drawImage(img, (int)ht.getCenterX() - 25, (int)ht.getCenterY() - 25, 50, 50, null);
return;
}
Collection<Hexagon<HexagonTile>> range = s.getRange(actor.getPos(), actor.getType().getAttackRange());
System.out.println(range);
......
......@@ -8,6 +8,11 @@
"name": "blue_base",
"player": 1,
"loc": "3,-3,1"
},
{
"name": "red_base",
"player": 0,
"loc": "2,3"
}
],
"repeated": [
......
......@@ -88,6 +88,9 @@
"image": "red/ufoRed",
"scale":0.25
},
"properties": {
"controlSignal": 10
},
"movement": 0,
"health": 10,
"attackRange": 2,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment