From c0e9f5feef0ac09389d94f608687d8b34a8d358b Mon Sep 17 00:00:00 2001 From: Jalen Winslow Date: Mon, 6 Nov 2017 14:10:05 -0700 Subject: [PATCH] added walls to map --- build/com/hobogames/utils/Map.class | Bin 2911 -> 3281 bytes res/maps/Game1_tutorialMap.txt | 1 + src/com/hobogames/utils/Map.java | 46 ++++++++++++++++++++++++++-- 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/build/com/hobogames/utils/Map.class b/build/com/hobogames/utils/Map.class index 69cef8bc032a1006c65ee03968b5aa18d223b8a1..55efaef6ad14ca874ffbeea538458524f81d6333 100644 GIT binary patch literal 3281 zcmb_eYfK#175?tb?9Q+m>}73?F%R2dY+!+fCEoZ!aDu@Pj34!4$FbAkfgQubzQPVM zc5BCpX_HbZQlv<2tx8q>hboaGHEO_3Dq2NxW2LRCwo+B8sj9Yr+h3Kc);LbTJF^B; zNYfu3IQQP~+;h)8uY2!)bpPFX0FUD90W{!X5$bU$z~-=l-T;oEPc}yl91Gw$P8j$? z04EXG(JUqVCG(Vl)3Sfcz!?Ki8#rs=oPlQye9^$O1_lhAH((hUG%#c!VZb(U!N9PA zks>59s$(pG8XS~ON;c^LGRVp%r{g&t;{y7Kl}V&*j;i_wCz7c|WGI`CjARG1!&chP zM-F+@dnuW=a^03=39LVNu5Z+O-ioBG%y1;`j3+b06!3Q>GfAgYU`zdfRn>4>K--^9 z*aB<&k{SEhM0(I3@3#h1*XGX>klUcM3QuvG)kF^Rw^YoTFr&*;HW)B4eM6*P>gwDIFOX47RMcHXpH(@D|K}0 zppk(@GM`IXm)v~=@$AI-knPDEWVOgmO|&3pq7h*ek0B;dJ3o4`Rt6HzC@W^GL^C<-<#HR19Z!w z-=c+7M~aiWNj;<|NVTMAb-ZNaI;I55{xiT`vcBwb6JNnsO}var9j}=9nsjVhhM{V; z0$fb5KyXRn@j{*+VtI8aQ1jVZPTE$&%Y~k|ofDSB5R}%hECg9S`mpWv+mnpQ`uc{I zA`BGMECaSaOz*H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?kd}k3t23DiMKqW#}kOwwAYG4G98F(C{3{0m)17jdN z%hoV%;7RN^5JaJY131WF8yy*;jHmE4#k&WFhplPeWc|d`5}q;eES{TEe5p}P7&wGc z4TlXJ5rfANdbeEpjRo?kEC8n;O+rRAG@%U)MJT4W#Hv*@YD!52B33bELL=BeOUfd=EykYMz5`7TW~4?;&|?xtu}r!^>qK$xYUP!xJr8-YJGkTP|lt zVw}z1d{e3QiO!41a7kI`7opE2^3G!9H$TIS&(<$fW>D>43@K#>L78IfH${?5lBh`u z=BG={^t=7^@P40dh|gfNUqb7mYv_M2G7XVQ&Yg0p$L&7>w@j3MZvXMShjcFWxgC+1 zLKW^1Yq=dhW6*{u5O4cw6k2}W8y$k5jUtmxAd5{CzE1oEa@bqQWph}?E+da!Bm9~8 zA1Gjdp^$SFaTO)pi&E}GIWL3B>1*OGsO0Ua=6zVh2N34tSj!KfmcI-ypF$mf4fXsa z8uXmJ%Q+m-UKfj&O**JabRj7u>c40l%P?W&V-_hRw zPotqbP=hcn&E)-9OL?3MdQN&3{tCX3UOEVrzNODON$JFW*0EdI zN1$OnTOlu(%UNNaO3Wc@?&V@5~_9hb=#SuEmx{!`;ntT`5VH+Ar wYe$bPPc|*qNsAHX5vOCTT%tI!Iu@6hEf+?|*#fwn>^#cmX-I}TO5&*h7Z5%(cK`qY diff --git a/res/maps/Game1_tutorialMap.txt b/res/maps/Game1_tutorialMap.txt index 29fb22a..e210d3b 100644 --- a/res/maps/Game1_tutorialMap.txt +++ b/res/maps/Game1_tutorialMap.txt @@ -9,6 +9,7 @@ hall 23 2 3 1 hall 0 7 4 1 hall 7 8 6 1 hall 17 9 1 3 +make_walls switch 17 11 1 lock_door 12 8 1 exit 0 7 diff --git a/src/com/hobogames/utils/Map.java b/src/com/hobogames/utils/Map.java index 967fc87..c595361 100644 --- a/src/com/hobogames/utils/Map.java +++ b/src/com/hobogames/utils/Map.java @@ -39,6 +39,25 @@ public class Map { } } break; + case "make_walls": + for (int j = 0; j < mapData.length; j++) { + for (int i = 0; i < mapData[j].length; i++) { + String wall = "%"; + if (j+1 != mapData.length && mapData[j+1][i] != null && + mapData[j+1][i].equals(".") && mapData[j][i] == null) + mapData[j][i] = wall; + if (j-1 != -1 && mapData[j-1][i] != null && + mapData[j-1][i].equals(".") && mapData[j][i] == null) + mapData[j][i] = wall; + if (i+1 != mapData[j].length && mapData[j][i+1] != null && + mapData[j][i+1].equals(".") && mapData[j][i] == null) + mapData[j][i] = wall; + if (i-1 != -1 && mapData[j][i-1] != null && + mapData[j][i-1].equals(".") && mapData[j][i] == null) + mapData[j][i] = wall; + } + } + break; case "switch": mapData[Integer.parseInt(object[2])][Integer.parseInt(object[1])] = "S"; break; @@ -62,8 +81,31 @@ public class Map { break; } } + for (int j = 0; j < mapData.length; j++) { for (int i = 0; i < mapData[j].length; i++) { + if (mapData[j][i] == null) mapData[j][i] = " "; + } + } + /* + for (int j = 0; j < mapData.length; j++) { + for (int i = 0; i < mapData[j].length; i++) { + if (mapData[j][i] == null) { + if (j+1 != mapData.length) { + if (mapData[j+1][i] != null) mapData[j][i] = "#"; + } + if (j-1 != -1) { + if (mapData[j-1][i] != null) mapData[j][i] = "#"; + } + if (i+1 != mapData[j].length) { + if (mapData[j][i+1] != null) mapData[j][i] = "#"; + } + if (i-1 != -1) { + if (mapData[j][i-1] != null) mapData[j][i] = "#"; + } + } + + /* if (mapData[j][i] == null) { if (j+1 != mapData.length && i+1 != mapData[j].length && (mapData[j+1][i] != null || mapData[j][i+1] != null)) { @@ -74,9 +116,9 @@ public class Map { mapData[j][i] = "#"; } else mapData[j][i] = " "; - } + }// } - } + } */ } public void displayMap() {