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 template file, choose Tools | Templates

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

@ -35,20 +35,9 @@ public class Inventory {
else{
if(items[selected] == null || items[selected].getId() == 0 || items[selected].getId() == 1){}
else{
switch(items[selected].getId()){
case 0:
break;
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;
}
Item temp = items[slot];
items[slot] = items[selected];
items[selected] = temp;
}
}
}

@ -15,9 +15,9 @@ public class Amulet extends Item {
public Amulet(int lvl) {
super(lvl);
this.dmg = 8 * lvl;
this.heal = 0 * lvl;
this.movementBoost = 10;
this.extraHp = 10 * lvl;
this.def = 3 * lvl;
this.movementBoost = 0;
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 ";
perk = "Damage: ";
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);
@ -184,7 +190,6 @@ public class HudContainer {
switch(item.getId()){
case 0:
if(InventoryItemSprites[x] == null){
//InventoryItemTextures[i] = new Texture("sprites/itemTest.png");
InventoryItemTextures[x] = new Texture("sprites/key.png");
InventoryItemSprites[x] = new Sprite(InventoryItemTextures[x]);
InventoryItemSprites[x].setX(invXPos[x]);
@ -194,7 +199,6 @@ public class HudContainer {
break;
case 1:
if(InventoryItemSprites[x] == null){
//InventoryItemTextures[i] = new Texture("sprites/itemTest.png");
InventoryItemTextures[x] = new Texture("sprites/potion.png");
InventoryItemSprites[x] = new Sprite(InventoryItemTextures[x]);
InventoryItemSprites[x].setX(invXPos[x]);
@ -204,7 +208,6 @@ public class HudContainer {
break;
case 2:
if(InventoryItemSprites[x] == null){
//InventoryItemTextures[i] = new Texture("sprites/itemTest.png");
InventoryItemTextures[x]= new Texture("sprites/amulet.png");
InventoryItemSprites[x] = new Sprite(InventoryItemTextures[x]);
InventoryItemSprites[x].setX(invXPos[x]);
@ -212,6 +215,15 @@ public class HudContainer {
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 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){
AnimatedObject ao;
switch(i.getId()){
case 0: // key
AnimatedObject ao1 = new AnimatedObject(new Texture("sprites/key.png"), width, height);
mapItems.add(ao1);
ao1.setSpritePosition(xPos, yPos);
ao = new AnimatedObject(new Texture("sprites/key.png"), width, height);
mapItems.add(ao);
ao.setSpritePosition(xPos, yPos);
break;
case 1: // potion
AnimatedObject ao2 = new AnimatedObject(new Texture("sprites/potion.png"), width, height);
mapItems.add(ao2);
ao2.setSpritePosition(xPos, yPos);
ao = new AnimatedObject(new Texture("sprites/potion.png"), width, height);
mapItems.add(ao);
ao.setSpritePosition(xPos, yPos);
break;
case 2: // amulet
AnimatedObject ao3 = new AnimatedObject(new Texture("sprites/amulet.png"), width, height);
mapItems.add(ao3);
ao3.setSpritePosition(xPos, yPos);
ao = new AnimatedObject(new Texture("sprites/amulet.png"), width, height);
mapItems.add(ao);
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;
}

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

Loading…
Cancel
Save