diff --git a/core/assets/mapData/map1/interactionObjects/0/dialogue.txt b/core/assets/mapData/map1/interactionObjects/0/dialogue.txt index bb668c6..3bf67f8 100644 --- a/core/assets/mapData/map1/interactionObjects/0/dialogue.txt +++ b/core/assets/mapData/map1/interactionObjects/0/dialogue.txt @@ -1,2 +1,2 @@ -Das hier ist ein Schild -interessant...#-1 \ No newline at end of file +Hier gehts noch nirgends hin +Das will ich sehen#-1 \ No newline at end of file diff --git a/core/assets/mapData/map1/interactionObjects/2/dialogue.txt b/core/assets/mapData/map1/interactionObjects/2/dialogue.txt new file mode 100644 index 0000000..3bf67f8 --- /dev/null +++ b/core/assets/mapData/map1/interactionObjects/2/dialogue.txt @@ -0,0 +1,2 @@ +Hier gehts noch nirgends hin +Das will ich sehen#-1 \ No newline at end of file diff --git a/core/assets/mapData/map1/npcs/1/dialogue.txt b/core/assets/mapData/map1/npcs/1/dialogue.txt index 363780f..cc76f6b 100644 --- a/core/assets/mapData/map1/npcs/1/dialogue.txt +++ b/core/assets/mapData/map1/npcs/1/dialogue.txt @@ -1,21 +1,16 @@ -Ich bin der zweite -gut#5 -schlecht#9 +Hey ich verstecke mich hier! +Ich werd nichts sagen#5 +Das wert ich verpetzen#9 Das freut mich -wie gehts dir#20 +wie gehts dir#15 tschüss#-1 -Das tut mir leid. Wieso denn? -Spaß mir gehts gut#5 -tschüss#-1 -Halts Maul#14 - Ey es gibt gleich Stress hier -cool, bin ich dabei#17 +cool, bin ich dabei#12 KAMPF LOS#-1 Ich will Krieg -KRIEG!#17 \ No newline at end of file +KRIEG!#12 \ No newline at end of file diff --git a/core/assets/mapData/map2/interactionObjects/0/dialogue.txt b/core/assets/mapData/map2/interactionObjects/0/dialogue.txt new file mode 100644 index 0000000..e13b7b3 --- /dev/null +++ b/core/assets/mapData/map2/interactionObjects/0/dialogue.txt @@ -0,0 +1,2 @@ +Im Regal sind viele Kochbücher +...#-1 \ No newline at end of file diff --git a/core/assets/tiledmapData/maps/map1.tmx b/core/assets/tiledmapData/maps/map1.tmx index c7e88e6..845c9f2 100644 --- a/core/assets/tiledmapData/maps/map1.tmx +++ b/core/assets/tiledmapData/maps/map1.tmx @@ -1,5 +1,5 @@ - + @@ -170,7 +170,7 @@ 3623,3623,3623,3623,3623,3623,3623,3623,3623,3623,3623,3623,3623,3623,3623,3623,3623,3623,3623,3623,3624,0,0,0,0,0,0,0,0,0,2067,2068,2309,0,0,0,0,0,0,0 - + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -224,7 +224,7 @@ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -348,8 +348,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - diff --git a/core/assets/tiledmapData/maps/map2.tmx b/core/assets/tiledmapData/maps/map2.tmx new file mode 100644 index 0000000..68299d8 --- /dev/null +++ b/core/assets/tiledmapData/maps/map2.tmx @@ -0,0 +1,125 @@ + + + + + + + +1803,1801,1801,1801,1801,1801,1801,1801,1801,983,0,1804, +983,983,983,983,983,983,983,983,983,983,983,983, +983,983,983,983,983,983,983,983,983,983,983,983, +983,983,983,983,983,983,983,983,983,983,983,983, +983,983,983,983,983,983,983,983,983,983,983,983, +983,983,983,983,983,983,983,983,983,983,983,983, +983,983,983,983,983,983,983,983,983,983,983,983, +983,983,983,983,983,983,983,983,983,983,983,983, +983,983,983,983,983,983,983,983,983,983,983,983, +983,983,983,983,983,983,983,983,983,983,983,983 + + + + +0,1830,1831,1832,1833,1834,0,0,0,0,0,0, +0,1862,1863,1864,1865,1866,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0 + + + + +0,2501,0,0,0,0,0,2531,2532,0,0,0, +0,0,0,0,0,0,0,2563,2564,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,1996,1996,0, +0,0,0,0,0,0,0,0,0,0,0,0, +0,0,2021,2022,2023,0,0,0,0,0,0,0, +0,0,2053,2054,2055,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,2691,2692,2693,0, +0,0,0,0,0,0,0,0,2723,2724,2725,0, +0,0,0,0,0,0,0,0,0,0,0,0 + + + + +0,0,0,0,0,0,0,0,0,1801,1801,0, +1805,0,0,0,0,0,0,0,0,1837,1869,1802, +1805,0,0,0,0,0,0,0,0,1964,1964,1802, +1805,0,0,0,0,0,0,0,0,0,0,1802, +1805,0,1989,2317,1991,0,0,0,0,0,0,0, +1805,0,0,0,0,0,0,0,0,0,0,0, +1805,0,0,0,0,0,0,0,2659,2660,2661,1802, +1805,0,0,0,0,0,0,0,0,0,0,1802, +1805,0,0,0,0,0,0,0,0,0,0,1802, +1807,1806,1806,1806,1806,0,0,1806,1806,1806,1806,1808 + + + + +0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,1990,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/assets/tiledmapData/pngs/worldBorder.png b/core/assets/tiledmapData/pngs/worldBorder.png new file mode 100644 index 0000000..7e77447 Binary files /dev/null and b/core/assets/tiledmapData/pngs/worldBorder.png differ diff --git a/core/assets/tiledmapData/tilesets/worldborder.tsx b/core/assets/tiledmapData/tilesets/worldborder.tsx new file mode 100644 index 0000000..e593730 --- /dev/null +++ b/core/assets/tiledmapData/tilesets/worldborder.tsx @@ -0,0 +1,4 @@ + + + + diff --git a/core/src/com/trs/main/InteractionObject.java b/core/src/com/trs/main/InteractionObject.java index 3aef5df..f24d3e6 100644 --- a/core/src/com/trs/main/InteractionObject.java +++ b/core/src/com/trs/main/InteractionObject.java @@ -38,6 +38,22 @@ public class InteractionObject extends Actor{ setBounds(xPos, yPos, animatedSprite.getSprite().getWidth(), animatedSprite.getSprite().getHeight()); } + public InteractionObject(Rectangle collisionRect, float xPos, float yPos,int mapId, int id){ + setName("interactive"); + this.id = id; + + currentlyTalking = false; + + this.collisionRect = collisionRect; + + dialoguePath = "mapData/map"+mapId+"/interactionObjects/"+id+"/dialogue.txt"; + parser = new DialogueParser(dialoguePath); + Dialogue nextDialogue = parser.firstDialogue(); + this.t = new Textbox(nextDialogue.question, nextDialogue.ans, getX()+getWidth()/2, getY()+getHeight()/2); + + setBounds(xPos, yPos, collisionRect.getWidth(), collisionRect.getHeight()); + } + public void startDialogue(float xPos, float yPos) { currentlyTalking = true; getStage().addActor(new Textbox(t, xPos, yPos)); @@ -45,7 +61,9 @@ public class InteractionObject extends Actor{ @Override protected void positionChanged() { - animatedSprite.setSpritePosition((int)getX(), (int)getY()); + + if(animatedSprite != null)animatedSprite.setSpritePosition((int)getX(), (int)getY()); + collisionRect = new Rectangle(getX() + 16, getY(), 32, 48); super.positionChanged(); } @@ -74,13 +92,13 @@ public class InteractionObject extends Actor{ } } - animatedSprite.updateAnimation(delta); + if(animatedSprite != null)animatedSprite.updateAnimation(delta); } @Override public void draw(Batch batch, float parentAlpha) { - animatedSprite.draw(batch); + if(animatedSprite != null)animatedSprite.draw(batch); super.draw(batch, parentAlpha); //To change body of generated methods, choose Tools | Templates. } diff --git a/core/src/com/trs/main/MapContainer.java b/core/src/com/trs/main/MapContainer.java index 62061d9..43ce50b 100644 --- a/core/src/com/trs/main/MapContainer.java +++ b/core/src/com/trs/main/MapContainer.java @@ -109,7 +109,13 @@ public class MapContainer { int id = props.get("id", Integer.class); String texture = props.get("texture", String.class); - stage.addActor(new InteractionObject(rect, rect.getX(), rect.getY(), mapId, id, texture)); + if(texture.equals("-")){ + stage.addActor(new InteractionObject(rect, rect.getX(), rect.getY(), mapId, id)); + } + else{ + stage.addActor(new InteractionObject(rect, rect.getX(), rect.getY(), mapId, id, texture)); + } + stage.addActor(new MapCollisionObject((int) rect.x, (int) rect.y, (int) rect.width, (int) rect.height)); } diff --git a/core/src/com/trs/main/view/screens/GameScreen.java b/core/src/com/trs/main/view/screens/GameScreen.java index 41af792..2809f91 100644 --- a/core/src/com/trs/main/view/screens/GameScreen.java +++ b/core/src/com/trs/main/view/screens/GameScreen.java @@ -22,11 +22,11 @@ public class GameScreen extends AbstractScreen{ super(game, CAMERA_WIDTH, CAMERA_HEIGHT); //setTextbox(new Textbox("How are you doing my friend How are you doing my friend How are you doing my friend How are you doing my friend", "good", "bad")); - map = new MapContainer(CAMERA_WIDTH, CAMERA_HEIGHT, new Player(200, 200), "tiledmapData/map2.tmx", 0, 2); + map = new MapContainer(CAMERA_WIDTH, CAMERA_HEIGHT, new Player(200, 200), "tiledmapData/maps/map1.tmx", 2, 1); } public void loadNewMap(int map, int doorId){ - String filename = "tiledmapData/map" + map + ".tmx"; + String filename = "tiledmapData/maps/map" + map + ".tmx"; this.map = new MapContainer(Main.CAMERA_WIDTH, Main.CAMERA_HEIGHT, this.map.getPlayer(), filename, doorId, map); }