|
|
|
|
@ -5,7 +5,9 @@
|
|
|
|
|
*/
|
|
|
|
|
package com.dungeoncrawler.view;
|
|
|
|
|
|
|
|
|
|
import com.badlogic.gdx.graphics.Texture;
|
|
|
|
|
import com.badlogic.gdx.maps.tiled.TiledMap;
|
|
|
|
|
import com.dungeoncrawler.model.Item;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -24,6 +26,28 @@ public class MapContainer {
|
|
|
|
|
this.mapItems = new ArrayList<>();
|
|
|
|
|
this.enemies = new EntitySprite[15];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void addItem(int width, int height, int xPos, int yPos, Item i){
|
|
|
|
|
switch(i.getId()){
|
|
|
|
|
case 0: // key
|
|
|
|
|
AnimatedObject ao1 = new AnimatedObject(new Texture("sprites/key.png"), width, height);
|
|
|
|
|
mapItems.add(ao1);
|
|
|
|
|
ao1.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);
|
|
|
|
|
break;
|
|
|
|
|
case 2: // amulet
|
|
|
|
|
AnimatedObject ao3 = new AnimatedObject(new Texture("sprites/amulet.png"), width, height);
|
|
|
|
|
mapItems.add(ao3);
|
|
|
|
|
ao3.setSpritePosition(xPos, yPos);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return the map
|
|
|
|
|
@ -52,13 +76,14 @@ public class MapContainer {
|
|
|
|
|
public void setObjects(ArrayList<AnimatedObject> objects) {
|
|
|
|
|
this.objects = objects;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return the mapItems
|
|
|
|
|
*/
|
|
|
|
|
public ArrayList<AnimatedObject> getMapItems() {
|
|
|
|
|
return mapItems;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param mapItems the mapItems to set
|
|
|
|
|
|