|
@@ -1,12 +1,16 @@
|
|
|
package pathgame.gameplay;
|
|
|
|
|
|
import pathgame.tilemap.TileMap;
|
|
|
+import pathgame.tilemap.Tiles;
|
|
|
|
|
|
public class Player
|
|
|
{
|
|
|
|
|
|
private static final float SPEED = 0.125f;
|
|
|
|
|
|
+ private PlayerAbilities abilities = new PlayerAbilities();
|
|
|
+ private int currAbilityBoost = 0;
|
|
|
+
|
|
|
private float lastX = 0;
|
|
|
private float lastY = 0;
|
|
|
private float x = 0;
|
|
@@ -28,6 +32,7 @@ public class Player
|
|
|
{
|
|
|
this.energySupply = energySupply;
|
|
|
this.objectivesAmount = objectivesAmount;
|
|
|
+ abilities.setClimberValues();
|
|
|
}
|
|
|
|
|
|
public float getLastX()
|
|
@@ -52,7 +57,38 @@ public class Player
|
|
|
|
|
|
public void tick(TileMap map)
|
|
|
{
|
|
|
- currSpeedSlowdown = map.getTile(Math.round(x), Math.round(y)).getEnergyCost();
|
|
|
+ if((map.getTile(Math.round(x), Math.round(y)) == Tiles.GRASS)
|
|
|
+ || (map.getTile(Math.round(x), Math.round(y)) == Tiles.GRASS_WITH_3_BUSHES)
|
|
|
+ || (map.getTile(Math.round(x), Math.round(y)) == Tiles.GRASS_WITH_6_BUSHES)
|
|
|
+ || (map.getTile(Math.round(x), Math.round(y)) == Tiles.GRASS_WITH_EARTH)
|
|
|
+ || (map.getTile(Math.round(x), Math.round(y)) == Tiles.GRASS_WITH_FLOWERS)
|
|
|
+ || (map.getTile(Math.round(x), Math.round(y)) == Tiles.GRASS_WITH_HILL)
|
|
|
+ || (map.getTile(Math.round(x), Math.round(y)) == Tiles.GRASS_WITH_STONE))
|
|
|
+ {
|
|
|
+ currAbilityBoost = abilities.getFasterGrass();
|
|
|
+ }
|
|
|
+ else if((map.getTile(Math.round(x), Math.round(y)) == Tiles.FOREST))
|
|
|
+ {
|
|
|
+ currAbilityBoost = abilities.getFasterForest();
|
|
|
+ }
|
|
|
+ else if((map.getTile(Math.round(x), Math.round(y)) == Tiles.HILL))
|
|
|
+ {
|
|
|
+ currAbilityBoost = abilities.getFasterHill();
|
|
|
+ }
|
|
|
+ else if((map.getTile(Math.round(x), Math.round(y)) == Tiles.MOUNTAIN))
|
|
|
+ {
|
|
|
+ currAbilityBoost = abilities.getFasterMountain();
|
|
|
+ }
|
|
|
+ else if((map.getTile(Math.round(x), Math.round(y)) == Tiles.SHALLOW_WATER))
|
|
|
+ {
|
|
|
+ currAbilityBoost = abilities.getFasterShallowWater();
|
|
|
+ }
|
|
|
+ else if((map.getTile(Math.round(x), Math.round(y)) == Tiles.DEEP_WATER))
|
|
|
+ {
|
|
|
+ currAbilityBoost = abilities.getFasterDeepWater();
|
|
|
+ }
|
|
|
+
|
|
|
+ currSpeedSlowdown = map.getTile(Math.round(x), Math.round(y)).getEnergyCost() - currAbilityBoost;
|
|
|
lastX = x;
|
|
|
lastY = y;
|
|
|
|
|
@@ -180,4 +216,9 @@ public class Player
|
|
|
{
|
|
|
return lastSteps;
|
|
|
}
|
|
|
+
|
|
|
+ public PlayerAbilities getAbilities()
|
|
|
+ {
|
|
|
+ return abilities;
|
|
|
+ }
|
|
|
}
|