Merge branch 'master' of https://git.ngb.schule/Tim/Zoelda
This commit is contained in:
@@ -9,7 +9,7 @@ import main.maps.TutorialMap;
|
||||
*/
|
||||
public class World extends Knoten {
|
||||
|
||||
public static final int SCALE_FACTOR = 6; // Der Basis Zoomfaktor
|
||||
public static final int SCALE_FACTOR = 4; // Der Basis Zoomfaktor
|
||||
public static final int SCALE = SCALE_FACTOR * Tile.getSize(); // Eine Gameunit ist so viele pixel lang
|
||||
|
||||
private Map currentMap; // Die Map die aktuell angezeigt werden soll.
|
||||
|
||||
@@ -17,6 +17,7 @@ public class PlayerInventory {
|
||||
*/
|
||||
public PlayerInventory(int inventorySize){
|
||||
items = new Item [inventorySize];
|
||||
currentItem = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -27,6 +28,30 @@ public class PlayerInventory {
|
||||
return coins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setzt die Anzahl von Coins im Inventar zu angegebener Anzahl.
|
||||
* @param coins Anzahl an coins als int, die im Inventar sein sollen.
|
||||
*/
|
||||
public void setCoins(int coins) {
|
||||
this.coins = coins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fügt die angegebene Anzahl an Coins in das Inventar hinzu.
|
||||
* @param amount Die Anzahl an Coins als int, die hinzugefügt werden soll.
|
||||
*/
|
||||
public void addCoins(int amount){
|
||||
this.coins+= amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Entfernt die angegebene Anzahl an Coins vom Inventar.
|
||||
* @param amount Die Anzahl an Coins als int, die entfernt werden soll.
|
||||
*/
|
||||
public void subtractCoins(int amount){
|
||||
this.coins-= amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter für das Items im Inventar.
|
||||
* @return gibt ein Array mit allen Item Objekten zurück, die im Inventar enthalten sind.
|
||||
@@ -43,6 +68,14 @@ public class PlayerInventory {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Entfernt ein Item auf angegebner Position im Item-Array.
|
||||
* @param itemPosition Position des Items das entfernt werden soll, angegeben als int.
|
||||
*/
|
||||
public void removeItem(int itemPosition) {
|
||||
items[itemPosition]=null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setzt das gerade ausgewählte Item fest.
|
||||
* @param currentItem int gibt an welcher Index des Item Arrays ausgewählt werden soll.
|
||||
@@ -51,6 +84,14 @@ public class PlayerInventory {
|
||||
this.currentItem = currentItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wechselt auf den nächsten Slot im Inventar.
|
||||
*/
|
||||
public void changeCurrentItem(){
|
||||
if(currentItem>=items.length) currentItem=0;
|
||||
else currentItem++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Methode zum Hinzufügen von Items.
|
||||
* @param newItem Das Item, dass hinzugefügt werden soll.
|
||||
|
||||
25
Zoelda/src/main/maps/Map01.java
Normal file
25
Zoelda/src/main/maps/Map01.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package main.maps;
|
||||
|
||||
import main.Tile;
|
||||
|
||||
public class Map01 extends Map {
|
||||
|
||||
public Map01 () {
|
||||
super (15,11);
|
||||
for (int x = 0; x < map.length; x++) {
|
||||
for (int y = 0; y < map[0].length; y++) {
|
||||
//Wand
|
||||
if((x == 4 || y == 9 || x == 10) && x > 3 && y > 0 && x < 11 && y < 10 && x != 7 ) {
|
||||
map[x][y] = new Tile(3, x, y);
|
||||
add(map[x][y]);
|
||||
}
|
||||
//Boden
|
||||
else if(x > 3 && y > 0 && x < 11 && y < 10) {
|
||||
map[x][y] = new Tile(5, x, y);
|
||||
add(map[x][y]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
38
Zoelda/src/main/maps/Map02.java
Normal file
38
Zoelda/src/main/maps/Map02.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package main.maps;
|
||||
|
||||
import main.Tile;
|
||||
|
||||
public class Map02 extends Map {
|
||||
|
||||
public Map02() {
|
||||
super(15, 11);
|
||||
|
||||
for (int x = 0; x < map.length; x++) {
|
||||
for (int y = 0; y < map[0].length; y++) {
|
||||
// Wand
|
||||
if (y == 0 || x == 0 || y == 10 || x == 14) {
|
||||
// Übergang, Tür
|
||||
if (y == 10) {
|
||||
if (x > 4 && x < 10) {
|
||||
map[x][y] = new Tile(5, x, y);
|
||||
add(map[x][y]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
map[x][y] = new Tile(3, x, y);
|
||||
add(map[x][y]);
|
||||
}
|
||||
// 3D-Wand
|
||||
else if(y == 1 ) {
|
||||
map[x][y] = new Tile(4, x, y);
|
||||
add(map[x][y]);
|
||||
}
|
||||
// Steinboden
|
||||
else {
|
||||
map[x][y] = new Tile(5, x, y);
|
||||
add(map[x][y]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user