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