The price of the shop items will rise, if you buy it.
Balancing: decrease the value of the ItemIncreaseDamage and the shop item "damage".
This commit is contained in:
parent
29fc971b03
commit
317e418c14
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB |
|
@ -17,7 +17,7 @@ public class ItemIncreaseDamage extends Item {
|
|||
if(player.getShootDamage() > 25) {
|
||||
return;
|
||||
} else {
|
||||
player.setShootDamage(player.getShootDamage()+5);
|
||||
player.setShootDamage(player.getShootDamage()+1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,18 +10,26 @@ public class ShopOffer extends Entity {
|
|||
|
||||
private String offer;
|
||||
private int bought;
|
||||
private int max;
|
||||
private final int max = 15;
|
||||
private final int price;
|
||||
private int currentPrice;
|
||||
private ImageEntity displayPrice;
|
||||
|
||||
public ShopOffer(int x, int y, int max, int bought, String offer) {
|
||||
public ShopOffer(int x, int y, int bought, String offer, int price) {
|
||||
super(x, y);
|
||||
this.offer = offer;
|
||||
this.bought = bought;
|
||||
this.max = max;
|
||||
this.price = price;
|
||||
if(bought == 0) this.currentPrice = price;
|
||||
else this.currentPrice = (int) (price+(price*bought*1.36));
|
||||
this.displayPrice = new ImageEntity(185, y+20, null);
|
||||
if(this.bought<this.max) this.displayPrice.drawString(String.valueOf(this.currentPrice) + "C", 20, Color.WHITE);
|
||||
else this.displayPrice.drawString("---", 20, Color.WHITE);
|
||||
for (int i = 0; i<max; i++){
|
||||
if(i<bought){
|
||||
new ImageEntity(x + 140 + i*35, y - 3, "images/shop/shopbought.png");
|
||||
new ImageEntity(x + 150 + i*35, y - 3, "images/shop/shopbought.png");
|
||||
}else{
|
||||
new ImageEntity(x + 140 + i*35, y - 3, "images/shop/shopnotbought.png");
|
||||
new ImageEntity(x + 150 + i*35, y - 3, "images/shop/shopnotbought.png");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,8 +44,11 @@ public class ShopOffer extends Entity {
|
|||
public void update() {}
|
||||
|
||||
public void buy(){
|
||||
new ImageEntity(this.getX() + 140 + bought*35, this.getY() - 3, "images/shop/shopbought.png");
|
||||
new ImageEntity(this.getX() + 150 + bought*35, this.getY() - 3, "images/shop/shopbought.png");
|
||||
bought++;
|
||||
this.currentPrice = (int) (price+(price*bought*1.36));
|
||||
if(this.bought<this.max) this.displayPrice.drawString(String.valueOf(this.currentPrice) + "C", 20, Color.WHITE);
|
||||
else this.displayPrice.drawString("----", 20, Color.WHITE);
|
||||
}
|
||||
|
||||
public int getBought() {
|
||||
|
@ -47,5 +58,9 @@ public class ShopOffer extends Entity {
|
|||
public int getMax() {
|
||||
return max;
|
||||
}
|
||||
|
||||
public int getCurrentPrice(){
|
||||
return this.currentPrice;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,9 +30,9 @@ public class ShopScreen extends Screen {
|
|||
super(parent);
|
||||
new ImageEntity(0, 0, "images/shopbackground.png");
|
||||
new Button(GameConfig.windowWidth/2-125, 500);
|
||||
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");
|
||||
damage = new ShopOffer(90, 150, PlayerSession.getBaseShotUpgradesBought(), "Schaden", 5);
|
||||
shield = new ShopOffer(90, 225, PlayerSession.getBaseShieldUpgradesBought(), "Schild", 10);
|
||||
life = new ShopOffer(90, 300, PlayerSession.getBaseHealthUpgradesBought(), "Leben", 10);
|
||||
new ImageEntity(GameConfig.windowWidth / 2 - 120, 365, "images/shop/shoprocket.png");
|
||||
new ImageEntity(GameConfig.windowWidth / 2 + 30, 365, "images/shop/shopbeam.png");
|
||||
if(PlayerSession.getSecondaryWeapon() == 1){
|
||||
|
@ -40,7 +40,7 @@ public class ShopScreen extends Screen {
|
|||
}else{
|
||||
select = new ImageEntity(GameConfig.windowWidth / 2 + 20, 355, "images/shop/select.png");
|
||||
}
|
||||
this.cursor = new ImageEntity(50, 149, "images/ship.png");
|
||||
this.cursor = new ImageEntity(40, 149, "images/ship.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -83,7 +83,7 @@ public class ShopScreen extends Screen {
|
|||
if(menuPoint == 3){
|
||||
this.cursor.setPosition(GameConfig.windowWidth/2-180, 390);
|
||||
}else{
|
||||
this.cursor.setPosition(50, 149+(this.menuPoint*75));
|
||||
this.cursor.setPosition(40, 149+(this.menuPoint*75));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,27 +94,27 @@ public class ShopScreen extends Screen {
|
|||
this.keyPressed = true;
|
||||
switch (this.menuPoint) {
|
||||
case 0:
|
||||
if(PlayerSession.getCredits() >= 5 && damage.getBought() < damage.getMax()){
|
||||
damage.buy();
|
||||
PlayerSession.addBaseShotDamage(5);
|
||||
if(PlayerSession.getCredits() >= damage.getCurrentPrice() && damage.getBought() < damage.getMax()){
|
||||
PlayerSession.addBaseShotDamage(2);
|
||||
PlayerSession.incrementBaseShotUpgradesBought();
|
||||
PlayerSession.removeCredits(5);
|
||||
PlayerSession.removeCredits(damage.getCurrentPrice());
|
||||
damage.buy();
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if(PlayerSession.getCredits() >= 10 && shield.getBought() < shield.getMax()){
|
||||
shield.buy();
|
||||
if(PlayerSession.getCredits() >= shield.getCurrentPrice() && shield.getBought() < shield.getMax()){
|
||||
PlayerSession.addBaseShieldPoints(10);
|
||||
PlayerSession.incrementBaseShieldUpgradesBought();
|
||||
PlayerSession.removeCredits(10);
|
||||
PlayerSession.removeCredits(shield.getCurrentPrice());
|
||||
shield.buy();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if(PlayerSession.getCredits() >= 10 && life.getBought() < life.getMax()){
|
||||
life.buy();
|
||||
if(PlayerSession.getCredits() >= life.getCurrentPrice() && life.getBought() < life.getMax()){
|
||||
PlayerSession.addBaseHealthPoints(10);
|
||||
PlayerSession.incrementBaseHealthUpgradesBought();
|
||||
PlayerSession.removeCredits(10);
|
||||
PlayerSession.removeCredits(life.getCurrentPrice());
|
||||
life.buy();
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
|
|
Loading…
Reference in New Issue