Merge branch 'master' of https://github.com/teamteamteam/SpaceScooter
This commit is contained in:
commit
042802ab87
|
@ -21,34 +21,34 @@ public class PlayerSession {
|
|||
* Damage value of the normal Shots the ship fires.
|
||||
* This can be changed by upgrades in the shop.
|
||||
*/
|
||||
private static int shipShotDamage;
|
||||
private static int baseShotDamage;
|
||||
|
||||
/**
|
||||
* The ships default maximum shield points.
|
||||
* This can be changed by upgrades in the shop.
|
||||
*/
|
||||
private static int shipShieldPoints;
|
||||
private static int baseShieldPoints;
|
||||
|
||||
/**
|
||||
* The ships default maximum health points.
|
||||
* This can be changed by upgrades in the shop.
|
||||
*/
|
||||
private static int shipHealthPoints;
|
||||
private static int baseHealthPoints;
|
||||
|
||||
/**
|
||||
* The number of health upgrades the player bought for the ship.
|
||||
*/
|
||||
private static int shipHealthUpgadesBought;
|
||||
private static int baseHealthUpgadesBought;
|
||||
|
||||
/**
|
||||
* The number of shield upgrades the player bought for the ship.
|
||||
*/
|
||||
private static int shipShieldUpgadesBought;
|
||||
private static int baseShieldUpgadesBought;
|
||||
|
||||
/**
|
||||
* The number of shot damage upgrades the player bought for the ship.
|
||||
*/
|
||||
private static int shipShotUpgadesBought;
|
||||
private static int baseShotUpgadesBought;
|
||||
|
||||
/**
|
||||
* The secondary weapon of the ship.
|
||||
|
@ -126,106 +126,106 @@ public class PlayerSession {
|
|||
/**
|
||||
* Get the ships maximum health points.
|
||||
*/
|
||||
public static int getShipHealthPoints() {
|
||||
return PlayerSession.shipHealthPoints;
|
||||
public static int getBaseHealthPoints() {
|
||||
return PlayerSession.baseHealthPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the ships maximum health points.
|
||||
*/
|
||||
public static void setShipHealthPoints(int shipHealthPoints) {
|
||||
PlayerSession.shipHealthPoints = shipHealthPoints;
|
||||
public static void setBaseHealthPoints(int baseHealthPoints) {
|
||||
PlayerSession.baseHealthPoints = baseHealthPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add to the ships maximum health points.
|
||||
*/
|
||||
public static void addShipHealthPoints(int shipHealthPoints) {
|
||||
PlayerSession.shipHealthPoints += shipHealthPoints;
|
||||
public static void addBaseHealthPoints(int baseHealthPoints) {
|
||||
PlayerSession.baseHealthPoints += baseHealthPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ships maximum shield points.
|
||||
*/
|
||||
public static int getShipShieldPoints() {
|
||||
return PlayerSession.shipShieldPoints;
|
||||
public static int getBaseShieldPoints() {
|
||||
return PlayerSession.baseShieldPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the ships maximum shield points.
|
||||
*/
|
||||
public static void setShipShieldPoints(int shipShieldPoints) {
|
||||
PlayerSession.shipShieldPoints = shipShieldPoints;
|
||||
public static void setBaseShieldPoints(int baseShieldPoints) {
|
||||
PlayerSession.baseShieldPoints = baseShieldPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add to the ships maximum shield points.
|
||||
*/
|
||||
public static void addShipShieldPoints(int shipShieldPoints) {
|
||||
PlayerSession.shipShieldPoints += shipShieldPoints;
|
||||
public static void addBaseShieldPoints(int baseShieldPoints) {
|
||||
PlayerSession.baseShieldPoints += baseShieldPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ships shot damage value.
|
||||
*/
|
||||
public static int getShipShotDamage() {
|
||||
return PlayerSession.shipShotDamage;
|
||||
public static int getBaseShotDamage() {
|
||||
return PlayerSession.baseShotDamage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the ships shot damage value.
|
||||
*/
|
||||
public static void setShipShotDamage(int shipShotDamage) {
|
||||
PlayerSession.shipShotDamage = shipShotDamage;
|
||||
public static void setBaseShotDamage(int baseShotDamage) {
|
||||
PlayerSession.baseShotDamage = baseShotDamage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add to the ships shot damage value.
|
||||
*/
|
||||
public static void addShipShotDamage(int shipShotDamage) {
|
||||
PlayerSession.shipShotDamage += shipShotDamage;
|
||||
public static void addBaseShotDamage(int shipShotDamage) {
|
||||
PlayerSession.baseShotDamage += shipShotDamage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of ship health upgrades the player bought in the shop.
|
||||
*/
|
||||
public static int getShipHealthUpgradesBought() {
|
||||
return PlayerSession.shipHealthUpgadesBought;
|
||||
public static int getBaseHealthUpgradesBought() {
|
||||
return PlayerSession.baseHealthUpgadesBought;
|
||||
}
|
||||
|
||||
/**
|
||||
* Increment the number of ship health upgrades the player bought.
|
||||
*/
|
||||
public static void incrementShipHealthUpgradesBought() {
|
||||
PlayerSession.shipHealthUpgadesBought++;
|
||||
public static void incrementBaseHealthUpgradesBought() {
|
||||
PlayerSession.baseHealthUpgadesBought++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of ship shield upgrades the player bought in the shop.
|
||||
*/
|
||||
public static int getShipShieldUpgradesBought() {
|
||||
return PlayerSession.shipShieldUpgadesBought;
|
||||
public static int getBaseShieldUpgradesBought() {
|
||||
return PlayerSession.baseShieldUpgadesBought;
|
||||
}
|
||||
|
||||
/**
|
||||
* Increment the number of ship shield upgrades the player bought.
|
||||
*/
|
||||
public static void incrementShipShieldUpgradesBought() {
|
||||
PlayerSession.shipShieldUpgadesBought++;
|
||||
public static void incrementBaseShieldUpgradesBought() {
|
||||
PlayerSession.baseShieldUpgadesBought++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of ship shot upgrades the player bought in the shop.
|
||||
*/
|
||||
public static int getShipShotUpgradesBought() {
|
||||
return PlayerSession.shipShotUpgadesBought;
|
||||
public static int getBaseShotUpgradesBought() {
|
||||
return PlayerSession.baseShotUpgadesBought;
|
||||
}
|
||||
|
||||
/**
|
||||
* Increment the number of ship shot upgrades the player bought.
|
||||
*/
|
||||
public static void incrementShipShotUpgradesBought() {
|
||||
PlayerSession.shipShotUpgadesBought++;
|
||||
public static void incrementBaseShotUpgradesBought() {
|
||||
PlayerSession.baseShotUpgadesBought++;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -267,12 +267,12 @@ public class PlayerSession {
|
|||
PlayerSession.score = 0;
|
||||
PlayerSession.secondaryWeapon = 1;
|
||||
PlayerSession.credits = 0;
|
||||
PlayerSession.shipHealthPoints = GameConfig.initialPlayerHealthPoints;
|
||||
PlayerSession.shipShieldPoints = GameConfig.initialPlayerShieldPoints;
|
||||
PlayerSession.shipShotDamage = GameConfig.initialPlayerShotDamage;
|
||||
PlayerSession.shipHealthUpgadesBought = 0;
|
||||
PlayerSession.shipShieldUpgadesBought = 0;
|
||||
PlayerSession.shipShotUpgadesBought = 0;
|
||||
PlayerSession.baseHealthPoints = GameConfig.initialPlayerHealthPoints;
|
||||
PlayerSession.baseShieldPoints = GameConfig.initialPlayerShieldPoints;
|
||||
PlayerSession.baseShotDamage = GameConfig.initialPlayerShotDamage;
|
||||
PlayerSession.baseHealthUpgadesBought = 0;
|
||||
PlayerSession.baseShieldUpgadesBought = 0;
|
||||
PlayerSession.baseShotUpgadesBought = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -66,11 +66,11 @@ public class Player extends ShootingEntity implements KeyboardListener {
|
|||
this.setShootSpeed(10);
|
||||
this.setCollisionDamage(5);
|
||||
this.setScore(0);
|
||||
this.setHealthPoints(PlayerSession.getShipHealthPoints());
|
||||
this.setMaximumHealthPoints(PlayerSession.getShipHealthPoints());
|
||||
this.setShieldPoints(PlayerSession.getShipShieldPoints());
|
||||
this.setMaximumShieldPoints(PlayerSession.getShipShieldPoints());
|
||||
this.setShootDamage((PlayerSession.getShipShotDamage())/2);
|
||||
this.setHealthPoints(PlayerSession.getBaseHealthPoints());
|
||||
this.setMaximumHealthPoints(PlayerSession.getBaseHealthPoints());
|
||||
this.setShieldPoints(PlayerSession.getBaseShieldPoints());
|
||||
this.setMaximumShieldPoints(PlayerSession.getBaseShieldPoints());
|
||||
this.setShootDamage(PlayerSession.getBaseShotDamage());
|
||||
this.registerOnKeyboard(Keyboard.getInstance());
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ public class Player extends ShootingEntity implements KeyboardListener {
|
|||
}
|
||||
super.remove();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* keyPressed method, comes in handy when a key on the keyboard is pressed
|
||||
*/
|
||||
|
|
|
@ -10,9 +10,16 @@ public class ItemIncreaseDamage extends Item {
|
|||
this.setImage("images/items/item.png");
|
||||
}
|
||||
|
||||
/**
|
||||
* Increase shoot damage of Player if not above 25.
|
||||
*/
|
||||
@Override
|
||||
public void itemCollected(Player player) {
|
||||
player.setShootDamage(player.getShootDamage()+5);
|
||||
if(player.getShootDamage() > 25) {
|
||||
return;
|
||||
} else {
|
||||
player.setShootDamage(player.getShootDamage()+5);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,9 +35,9 @@ public class ShopScreen extends Screen {
|
|||
super(parent);
|
||||
this.img = Loader.getBufferedImageByFilename("images/shopbackground.png");
|
||||
new Button(GameConfig.windowWidth/2-125, 500);
|
||||
damage = new ShopOffer(100, 150, 15, PlayerSession.getShipShotUpgradesBought(), "Schaden 5C");
|
||||
shield = new ShopOffer(100, 225, 15, PlayerSession.getShipShieldUpgradesBought(), "Schild 10C");
|
||||
life = new ShopOffer(100, 300, 15, PlayerSession.getShipHealthUpgradesBought(), "Leben 10C");
|
||||
damage = new ShopOffer(100, 150, 15, PlayerSession.getBaseShotUpgradesBought(), "Schaden 5C");
|
||||
shield = new ShopOffer(100, 225, 15, PlayerSession.getBaseShieldUpgradesBought(), "Schild 10C");
|
||||
life = new ShopOffer(100, 300, 15, PlayerSession.getBaseHealthUpgradesBought(), "Leben 10C");
|
||||
new ImageEntity(GameConfig.windowWidth / 2 - 120, 365, "images/shop/shoprocket.png");
|
||||
new ImageEntity(GameConfig.windowWidth / 2 + 30, 365, "images/shop/shopbeam.png");
|
||||
if(PlayerSession.getSecondsecondaryWeapon() == 1){
|
||||
|
@ -106,24 +106,24 @@ public class ShopScreen extends Screen {
|
|||
case 0:
|
||||
if(PlayerSession.getCredits() >= 5 && damage.getBought() < damage.getMax()){
|
||||
damage.buy();
|
||||
PlayerSession.addShipShotDamage(5);
|
||||
PlayerSession.incrementShipShotUpgradesBought();
|
||||
PlayerSession.addBaseShotDamage(5);
|
||||
PlayerSession.incrementBaseShotUpgradesBought();
|
||||
PlayerSession.removeCredits(5);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if(PlayerSession.getCredits() >= 10 && shield.getBought() < shield.getMax()){
|
||||
shield.buy();
|
||||
PlayerSession.addShipShieldPoints(10);
|
||||
PlayerSession.incrementShipShieldUpgradesBought();
|
||||
PlayerSession.addBaseShieldPoints(10);
|
||||
PlayerSession.incrementBaseShieldUpgradesBought();
|
||||
PlayerSession.removeCredits(10);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if(PlayerSession.getCredits() >= 10 && life.getBought() < life.getMax()){
|
||||
life.buy();
|
||||
PlayerSession.addShipHealthPoints(10);
|
||||
PlayerSession.incrementShipHealthUpgradesBought();
|
||||
PlayerSession.addBaseHealthPoints(10);
|
||||
PlayerSession.incrementBaseHealthUpgradesBought();
|
||||
PlayerSession.removeCredits(10);
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue