master
GammelJAN 6 years ago
parent 00b95d7e79
commit e3e56c2999

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

@ -1,3 +1,4 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates * To change this template file, choose Tools | Templates

@ -7,6 +7,7 @@ package com.dungeoncrawler.model;
import com.dungeoncrawler.model.entities.*; import com.dungeoncrawler.model.entities.*;
import com.dungeoncrawler.model.items.Amulet; import com.dungeoncrawler.model.items.Amulet;
import com.dungeoncrawler.model.items.DmgAmulet;
import com.dungeoncrawler.model.items.Potion; import com.dungeoncrawler.model.items.Potion;
import com.dungeoncrawler.model.items.Key; import com.dungeoncrawler.model.items.Key;
import java.util.ArrayList; import java.util.ArrayList;
@ -225,7 +226,7 @@ public class DungeonGenerator {
Item tempItem; Item tempItem;
int id = (int) (Math.random() * 2); int id = (int) (Math.random() * 3);
switch(id){ switch(id){
case 0: case 0:
tempItem = new Amulet(lvl); tempItem = new Amulet(lvl);
@ -234,6 +235,9 @@ public class DungeonGenerator {
case 1: case 1:
tempItem = new Potion(lvl); tempItem = new Potion(lvl);
break; break;
case 2:
tempItem = new DmgAmulet(lvl);
break;
default: default:
tempItem = null; tempItem = null;

@ -35,20 +35,9 @@ public class Inventory {
else{ else{
if(items[selected] == null || items[selected].getId() == 0 || items[selected].getId() == 1){} if(items[selected] == null || items[selected].getId() == 0 || items[selected].getId() == 1){}
else{ else{
switch(items[selected].getId()){ Item temp = items[slot];
case 0: items[slot] = items[selected];
break; items[selected] = temp;
case 1:
Item temp1 = items[slot];
items[slot] = items[selected];
items[selected] = temp1;
break;
case 2:
Item temp2 = items[slot];
items[slot] = items[selected];
items[selected] = temp2;
break;
}
} }
} }
} }

@ -15,9 +15,9 @@ public class Amulet extends Item {
public Amulet(int lvl) { public Amulet(int lvl) {
super(lvl); super(lvl);
this.dmg = 8 * lvl; this.extraHp = 10 * lvl;
this.heal = 0 * lvl; this.def = 3 * lvl;
this.movementBoost = 10; this.movementBoost = 0;
this.id = 2; this.id = 2;
} }

@ -0,0 +1,23 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.dungeoncrawler.model.items;
import com.dungeoncrawler.model.Item;
/**
*
* @author jonathan
*/
public class DmgAmulet extends Item {
public DmgAmulet(int lvl) {
super(lvl);
this.dmg = 8 * lvl;
this.movementBoost = 1;
this.id = 3;
}
}

@ -168,6 +168,12 @@ public class HudContainer {
selectedName = "Amulet "; selectedName = "Amulet ";
perk = "Damage: "; perk = "Damage: ";
selectedPerkValue = items[selected].getDmg(); selectedPerkValue = items[selected].getDmg();
break;
case 3:
selectedName = "Damage-Amulet ";
perk = "Damage: ";
selectedPerkValue = items[selected].getDmg();
break;
} }
font.draw(batch, selectedName + lvl, HudPosX + 40, HudPosY + 210); font.draw(batch, selectedName + lvl, HudPosX + 40, HudPosY + 210);
@ -184,7 +190,6 @@ public class HudContainer {
switch(item.getId()){ switch(item.getId()){
case 0: case 0:
if(InventoryItemSprites[x] == null){ if(InventoryItemSprites[x] == null){
//InventoryItemTextures[i] = new Texture("sprites/itemTest.png");
InventoryItemTextures[x] = new Texture("sprites/key.png"); InventoryItemTextures[x] = new Texture("sprites/key.png");
InventoryItemSprites[x] = new Sprite(InventoryItemTextures[x]); InventoryItemSprites[x] = new Sprite(InventoryItemTextures[x]);
InventoryItemSprites[x].setX(invXPos[x]); InventoryItemSprites[x].setX(invXPos[x]);
@ -194,7 +199,6 @@ public class HudContainer {
break; break;
case 1: case 1:
if(InventoryItemSprites[x] == null){ if(InventoryItemSprites[x] == null){
//InventoryItemTextures[i] = new Texture("sprites/itemTest.png");
InventoryItemTextures[x] = new Texture("sprites/potion.png"); InventoryItemTextures[x] = new Texture("sprites/potion.png");
InventoryItemSprites[x] = new Sprite(InventoryItemTextures[x]); InventoryItemSprites[x] = new Sprite(InventoryItemTextures[x]);
InventoryItemSprites[x].setX(invXPos[x]); InventoryItemSprites[x].setX(invXPos[x]);
@ -204,7 +208,6 @@ public class HudContainer {
break; break;
case 2: case 2:
if(InventoryItemSprites[x] == null){ if(InventoryItemSprites[x] == null){
//InventoryItemTextures[i] = new Texture("sprites/itemTest.png");
InventoryItemTextures[x]= new Texture("sprites/amulet.png"); InventoryItemTextures[x]= new Texture("sprites/amulet.png");
InventoryItemSprites[x] = new Sprite(InventoryItemTextures[x]); InventoryItemSprites[x] = new Sprite(InventoryItemTextures[x]);
InventoryItemSprites[x].setX(invXPos[x]); InventoryItemSprites[x].setX(invXPos[x]);
@ -212,6 +215,15 @@ public class HudContainer {
break; break;
} }
break; break;
case 3:
if(InventoryItemSprites[x] == null){
InventoryItemTextures[x]= new Texture("sprites/dmgAmulet.png");
InventoryItemSprites[x] = new Sprite(InventoryItemTextures[x]);
InventoryItemSprites[x].setX(invXPos[x]);
InventoryItemSprites[x].setY(invYPos[x]);
break;
}
break;
} }
} }

@ -1,3 +1,4 @@
/* /*
* To change this license header, choose License Headers in Project Properties. * To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates * To change this template file, choose Tools | Templates

@ -39,21 +39,27 @@ public class MapContainer {
public void addItem(int width, int height, int xPos, int yPos, Item i){ public void addItem(int width, int height, int xPos, int yPos, Item i){
AnimatedObject ao;
switch(i.getId()){ switch(i.getId()){
case 0: // key case 0: // key
AnimatedObject ao1 = new AnimatedObject(new Texture("sprites/key.png"), width, height); ao = new AnimatedObject(new Texture("sprites/key.png"), width, height);
mapItems.add(ao1); mapItems.add(ao);
ao1.setSpritePosition(xPos, yPos); ao.setSpritePosition(xPos, yPos);
break; break;
case 1: // potion case 1: // potion
AnimatedObject ao2 = new AnimatedObject(new Texture("sprites/potion.png"), width, height); ao = new AnimatedObject(new Texture("sprites/potion.png"), width, height);
mapItems.add(ao2); mapItems.add(ao);
ao2.setSpritePosition(xPos, yPos); ao.setSpritePosition(xPos, yPos);
break; break;
case 2: // amulet case 2: // amulet
AnimatedObject ao3 = new AnimatedObject(new Texture("sprites/amulet.png"), width, height); ao = new AnimatedObject(new Texture("sprites/amulet.png"), width, height);
mapItems.add(ao3); mapItems.add(ao);
ao3.setSpritePosition(xPos, yPos); ao.setSpritePosition(xPos, yPos);
break;
case 3: // DamageAmulet
ao = new AnimatedObject(new Texture("sprites/dmgAmulet.png"), width, height);
mapItems.add(ao);
ao.setSpritePosition(xPos, yPos);
break; break;
} }

@ -30,6 +30,7 @@ public class MapGenerator {
Texture amulet; Texture amulet;
Texture key; Texture key;
Texture potion; Texture potion;
Texture DmgAmulet;
Texture doorTop; Texture doorTop;
Texture doorLeft; Texture doorLeft;
Texture doorRight; Texture doorRight;
@ -43,6 +44,7 @@ public class MapGenerator {
} }
torchT = new Texture("sprites/torch.png"); torchT = new Texture("sprites/torch.png");
amulet = new Texture("sprites/amulet.png"); amulet = new Texture("sprites/amulet.png");
DmgAmulet = new Texture("sprites/dmgAmulet.png");
key = new Texture("sprites/key.png"); key = new Texture("sprites/key.png");
potion = new Texture("sprites/potion.png"); potion = new Texture("sprites/potion.png");
doorTop = new Texture("sprites/door.png"); doorTop = new Texture("sprites/door.png");
@ -399,6 +401,10 @@ public class MapGenerator {
case 2: case 2:
itemSprite = new AnimatedObject(amulet, 48, 48); itemSprite = new AnimatedObject(amulet, 48, 48);
break; break;
case 3:
itemSprite = new AnimatedObject(DmgAmulet, 48, 48);
break;
} }
itemSprite.getSprite().setPosition(container.getxPos(), container.getyPos()); itemSprite.getSprite().setPosition(container.getxPos(), container.getyPos());

Loading…
Cancel
Save