From 0cdbfa693a30d045f23aad1fbb0232abd285c58d Mon Sep 17 00:00:00 2001 From: GammelJAN Date: Thu, 24 Dec 2020 13:21:39 +0100 Subject: [PATCH] tiledMap edited --- .../map1/interactionObjects/0/dialogue.txt | 4 +- .../map1/interactionObjects/2/dialogue.txt | 2 + core/assets/mapData/map1/npcs/1/dialogue.txt | 17 +-- .../map2/interactionObjects/0/dialogue.txt | 2 + core/assets/tiledmapData/maps/map1.tmx | 81 +++++++++++- core/assets/tiledmapData/maps/map2.tmx | 125 ++++++++++++++++++ core/assets/tiledmapData/pngs/worldBorder.png | Bin 0 -> 1003 bytes .../tiledmapData/tilesets/worldborder.tsx | 4 + core/src/com/trs/main/InteractionObject.java | 24 +++- core/src/com/trs/main/MapContainer.java | 8 +- .../com/trs/main/view/screens/GameScreen.java | 4 +- 11 files changed, 246 insertions(+), 25 deletions(-) create mode 100644 core/assets/mapData/map1/interactionObjects/2/dialogue.txt create mode 100644 core/assets/mapData/map2/interactionObjects/0/dialogue.txt create mode 100644 core/assets/tiledmapData/maps/map2.tmx create mode 100644 core/assets/tiledmapData/pngs/worldBorder.png create mode 100644 core/assets/tiledmapData/tilesets/worldborder.tsx 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 0000000000000000000000000000000000000000..7e77447084fd6f5beb2e7cd5f7401a936a0dcda0 GIT binary patch literal 1003 zcmeAS@N?(olHy`uVBq!ia0vp^4M6O`!3HERU8}EWU|?*@baoE#baqxKD9TUE%t>Wn z&^SMJqNNA3qeQE{u`bUBmX*4l*3hv=5H&+wfG<$>e#*HF5tla&_ zR&UsN?b@L*0TzA%ZEtN?>4{(G`zkngJUCz=pa0A@?ViH}gXE~ZQvQgtd!4=RTW;>G zT>Gt6;OrGcm-TtOcE0!$F{kVC=RU2i_sUl5{4IrGmAeR@;=m@{d3Nv z*oPZtUK2i)ekistCg6wTOSi^&(d9LKE6!{X?(gMjZ`~RqDV>_LOxC-?VTWzv%}Mez zbPJq5?n=_$oF(>tWt>FRw)ACF^)~kws&yE(wjI>cPC0Q|ceQSpx6e0a(LZbV)qBOX z?FchCYUm}#efRs~e-FyH=WW`*eu7As!`aQx_m(@nHLJ<5ymx)#^ICc551e{$C)rnX zILj}}pStB6bH<&9&#Nb;y*Y4HZHvvb68G;*7o2f0;>=(E$+!4I3G-L()_YyQ=iG6Q z*)?lV+uqt2KAzu_TFb9b{r>H_&&^HED`9XhN=+(P&YkAJO-t=C>G+2$zaaM?s&`hc~6 zoy>dfjb;l|SaNmt71_nw9CSZESN%}Esi}a2>c@BAX0L2z(CT`8cmJvHuLXmHrRN); zDqJ2n`CHw7^`{nAQSB0~WwVwokqJ+aY%kmWG^l5@@fydE+>Z9KFIN7Yxjnq7f9`tb zBOi}%JTBEzvAaLKw(e8^HTC;y*OtF1ZTPy}$L@1z?QBZ?a9l!*+`K$Cv-iGn9X + + + 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); }