From a4a77fb8dd12e994284c059eefd56f75cf91c020 Mon Sep 17 00:00:00 2001 From: Jalen Winslow Date: Mon, 6 Nov 2017 10:55:21 -0700 Subject: [PATCH] Initial commit --- Game1_Launcher.class | Bin 0 -> 507 bytes Game1_Launcher.java | 9 ++ about/Game1_GameDesignDoc.txt | 43 +++++++++ build/com/hobogames/Game.class | Bin 0 -> 1863 bytes build/com/hobogames/Handler.class | Bin 0 -> 1345 bytes build/com/hobogames/gameobj/GOHandler.class | Bin 0 -> 886 bytes build/com/hobogames/gameobj/GameObject.class | Bin 0 -> 1404 bytes .../hobogames/gameobj/entities/Entity.class | Bin 0 -> 3902 bytes .../gameobj/entities/humans/Human.class | Bin 0 -> 818 bytes .../gameobj/entities/humans/Player.class | Bin 0 -> 1794 bytes .../hobogames/gameobj/nonentities/Wall.class | Bin 0 -> 624 bytes build/com/hobogames/states/MenuState.class | Bin 0 -> 2557 bytes build/com/hobogames/states/PlayState.class | Bin 0 -> 1583 bytes build/com/hobogames/states/State.class | Bin 0 -> 995 bytes build/com/hobogames/utils/Choice.class | Bin 0 -> 1033 bytes build/com/hobogames/utils/Controller.class | Bin 0 -> 2710 bytes build/com/hobogames/utils/Map.class | Bin 0 -> 2911 bytes build/com/hobogames/utils/ReadFile.class | Bin 0 -> 1728 bytes res/maps/Game1_tutorialMap.txt | 21 ++++ res/texts/Game1_intro.txt | 6 ++ res/texts/Game1_menuScreen.txt | 4 + src/com/hobogames/Game.java | 51 ++++++++++ src/com/hobogames/Handler.java | 26 +++++ src/com/hobogames/gameobj/GOHandler.java | 23 +++++ src/com/hobogames/gameobj/GameObject.java | 35 +++++++ .../hobogames/gameobj/entities/Entity.java | 65 +++++++++++++ .../gameobj/entities/humans/Human.java | 38 ++++++++ .../gameobj/entities/humans/Player.java | 46 +++++++++ .../hobogames/gameobj/nonentities/Wall.java | 28 ++++++ src/com/hobogames/states/MenuState.java | 60 ++++++++++++ src/com/hobogames/states/PlayState.java | 43 +++++++++ src/com/hobogames/states/State.java | 25 +++++ src/com/hobogames/utils/Choice.java | 32 +++++++ src/com/hobogames/utils/Controller.java | 54 +++++++++++ src/com/hobogames/utils/Map.java | 90 ++++++++++++++++++ src/com/hobogames/utils/ReadFile.java | 41 ++++++++ 36 files changed, 740 insertions(+) create mode 100644 Game1_Launcher.class create mode 100644 Game1_Launcher.java create mode 100644 about/Game1_GameDesignDoc.txt create mode 100644 build/com/hobogames/Game.class create mode 100644 build/com/hobogames/Handler.class create mode 100644 build/com/hobogames/gameobj/GOHandler.class create mode 100644 build/com/hobogames/gameobj/GameObject.class create mode 100644 build/com/hobogames/gameobj/entities/Entity.class create mode 100644 build/com/hobogames/gameobj/entities/humans/Human.class create mode 100644 build/com/hobogames/gameobj/entities/humans/Player.class create mode 100644 build/com/hobogames/gameobj/nonentities/Wall.class create mode 100644 build/com/hobogames/states/MenuState.class create mode 100644 build/com/hobogames/states/PlayState.class create mode 100644 build/com/hobogames/states/State.class create mode 100644 build/com/hobogames/utils/Choice.class create mode 100644 build/com/hobogames/utils/Controller.class create mode 100644 build/com/hobogames/utils/Map.class create mode 100644 build/com/hobogames/utils/ReadFile.class create mode 100644 res/maps/Game1_tutorialMap.txt create mode 100644 res/texts/Game1_intro.txt create mode 100644 res/texts/Game1_menuScreen.txt create mode 100644 src/com/hobogames/Game.java create mode 100644 src/com/hobogames/Handler.java create mode 100644 src/com/hobogames/gameobj/GOHandler.java create mode 100644 src/com/hobogames/gameobj/GameObject.java create mode 100644 src/com/hobogames/gameobj/entities/Entity.java create mode 100644 src/com/hobogames/gameobj/entities/humans/Human.java create mode 100644 src/com/hobogames/gameobj/entities/humans/Player.java create mode 100644 src/com/hobogames/gameobj/nonentities/Wall.java create mode 100644 src/com/hobogames/states/MenuState.java create mode 100644 src/com/hobogames/states/PlayState.java create mode 100644 src/com/hobogames/states/State.java create mode 100644 src/com/hobogames/utils/Choice.java create mode 100644 src/com/hobogames/utils/Controller.java create mode 100644 src/com/hobogames/utils/Map.java create mode 100644 src/com/hobogames/utils/ReadFile.java diff --git a/Game1_Launcher.class b/Game1_Launcher.class new file mode 100644 index 0000000000000000000000000000000000000000..2c87f8815dbfdf5a3bfb5a89b3bcd1b33a28c6fc GIT binary patch literal 507 zcmZ`#O-sW-6r4@dB#r&D)mW<+Z&kq{c&m636k*Xrr63+;lZJFlJ|s>2UtTOI_yhb= z;@eax13;*jhZ`rIpIG;#ejcBiSADs=9uCYe_YLH5TQ(~iRt@OUX3fAlK9J!<89p)?z+oL9>)602dE7B@7x(1&ejcA{ zc%b2-LT=w~J6oQD+EdUDY_HjJx(cOQz3;Y~R>N;w2Y%g`sGfB{x?WMx+m6@Y3GBd8 zm`jZ9$z{(9V+7D?+0SD@Zq@bNU|k_yS$wLH+3=f8Q>eL~^QhmhJKZOCy~UGa&2QMP zr*_wseSDY+4&0u?Od{z$$|PAv@+;&;b*ptx{P`4g$@tKKBqHPCd z4Npvb4%#RhSC9P+4PTh}61yfAQRchc`Nj=gZ@(;0wWM%1Nv-%-I3*RZTDG@uZPlMS z4L)$GlK46jzanKUC*S|u#$iYjVO$>ejP!Sb@3YbGb{#K>PcA0s9fgJb1@^>$k@F`v zRG6PFk?VJwA@_*so#(y4X|qxNKCMsI!g9F2wcT|^Sl6-JM4nDK=7-&ppcdPFvJwHq zIuga&Qz|a-Z(*8$JQ<{^HFJnm^*5wzfsHCI$4M;CVk0XSe&8Y%ip+(FOC#Xy z0DJ{kWAJhe&P#<~BlqJmyfuQ)5AaK@a`d31__5c}kK?Z;;;-SI7=N2;rFnAISvJJb Yex!amL{CK#F*{?!o)y!}q1x;J0Apf&&j0`b literal 0 HcmV?d00001 diff --git a/build/com/hobogames/Handler.class b/build/com/hobogames/Handler.class new file mode 100644 index 0000000000000000000000000000000000000000..5ed6356b10048df91b20edb582683b31c84573aa GIT binary patch literal 1345 zcma)5X>Zd&5Ph4ZabuR=N9Y0c0Fo4HD5V@N<&rq0KoLQe$~PyqQdf?Rd?58d@c|HR zC6M?5{3yg*+k`5(5?^L_XXd?`-8cL5*S8-4R`FQJ5Nah1VoAeQ9r@&NO~Y~t2CnNU z;)V*Z=(vehWo{|6rqf4r8+SC^)o@Rs&^9}kz*M~%+0L%f@;b(z*YuP(FrLw_GsidG zU4fDMzWKp4qR@7XH}rTN#&SVRVDvR!uqwoTtw=hRsU_w0bAnViqrmlIdl+E%Fg7nrG3Gjr41mD0p5 zS0G=hz7vr2ytLe?5thok*W)IwtRuLQwl0kyym`P zxuG4}EWH1crKLlo-XB!0=yxDx!uB ziTl`8=m!$xn9%T0;v(iG=CL5Lh)WtCNnFMif$6LfN}Kpo)iK?+vDMtST4DU!R6l7a z4m1ve(CTogY-%x{43+H}FWmQ0*a&^gR1;UOWCqkAm9siXhF~!(lq%TO0dxExL;PZS z3wWUMkYTuFHIY!|SecTpzzCb%h{~=1B znU=#8?F9O02M8TRiRH#vYM#ZW<5*0G8O-uT;sR0-=pVU1i61|K@9*L%b~gS@Z~ci(Jm(}EFMIKmnRw3E UKlme@J;FdQzMP4##J8;e27j#+ga7~l literal 0 HcmV?d00001 diff --git a/build/com/hobogames/gameobj/GOHandler.class b/build/com/hobogames/gameobj/GOHandler.class new file mode 100644 index 0000000000000000000000000000000000000000..cba6198562db0faf15a722eb1f6c942cd95baa1b GIT binary patch literal 886 zcmaJfgc5PfT>apSrlNoXmALTPE5qz%4sOH_oAS}GZONY(q=v62mrT{(88azo;m zaN&#uLE?Zoao`{DR}cbb9XsM+Vauc0=b88BW556Y`~|=xv~`qlw}eI9lV)4Tee6iH ztKor;BK9=YHS9BJL+{xhx(+S4rFtCFGAG;It+3a_RVMzjK_Q-Xj3B$TI z;#b^^BjK4(!jNBEViHkQsV4?LkK)i}c$^p0&6Sbdfju%$<{F(NVk>rqFQOxc?M7}| zR$cRgq3|^5ljy1?eD_5>w%zcY+a4hmD{#1X!9yX>DOiYxg4)>6rJYxEmI+WP@nxS! zM5i{S8WZ%LGA#EZ?!0`?FH>H<7sR3C9t)|wa*`1|l+!Y>hD`%HmJAqJ*3dA}M9aVd z4jJls0-ueXAI`|0XeG*qCy8@N0fdb{1 z=yZcl8x&8`SSL?DdZI$(mYt`ZuT##p+O4%dK%JuS7CX|bO|kF|<;?wx;uP8&#@_w; zA!Sua*$pg^Et6=4D66QGe@JL1ub_onxJ_a}J1wL}z7F*l6t?@5@)_jO1W;ujOONrNUBqTk%Mo3f}t$-1+_I=Pv*|cs!0gw(}T+CvaEbp1^&92Ld||9y)lW z;2ioc>9mqY+&J=H(!OpS1~3t0HC(PFjAS>Vr2LO>+TOIck2`xH+zb# zfb|tQ>%%wXTrN&wf1z6j^TZW6#3CgpNn0XLk#ZVkN?hmaDsSfvEv{jKI|}GDm8Gyq zKhQ2Ec3CXbS;1C NG!xw2=2-@J{sR9e$g2PV literal 0 HcmV?d00001 diff --git a/build/com/hobogames/gameobj/entities/Entity.class b/build/com/hobogames/gameobj/entities/Entity.class new file mode 100644 index 0000000000000000000000000000000000000000..1c484479a5098c0f23f1346eaf9fbfc18d10e83c GIT binary patch literal 3902 zcmaKuX;T|V5Qcj|2RZ;7+c=4h4L(3zmhS^FHU?~z$VVcFICoakSXx-^5^16A|CBGO zN-9kM$hkc)&-d@e@zyJOH4-ws_FiU6X=M0^uUmy;o3aLTr z5Dj??X+W9~7qSD{g?Nw_#D@fsJ;<+VYNx5AXt3_K6{(V(G9Eza4S%t{-a8a~s-VvwON-(|e&C_-w8< zownO)@gfu6evMa^T5)|hTvaq#C|CDguU@PLtzt8%1`VgBJH;)>uY0<^JiE=7^`OoR z9WA@QezD)G>h^1=>ha82IjA|_HlvYuClg`Q<)^kNVgV1TJ4Nk>Zs_uTHZgd=%ti6z zz#SD$h|b=EcsZ@$08g_}Dq(el1!$_F!wvL_Q|?rT(_Vw}Jbr%EFZ^q*+nX$0z4i=o zQi(b=!ow&1O~S-Rf1d!|I%-vt(>L5LFv?NGay+aY_6&Dg>$MH$&7;nZa#}jpykVYs z)z?3;_^s%+FwI#x>SCu`b)sONMTYakvU%KJHm8SW!**CUC%v+Hc)V;}c&u!m=r5a7 zQ#Qw5**xqko3o>`Iq5H(Q>$#AIaW63ePweNm7T2w`}}f0b@3ABqF3nJj&tDTX`UAH zG)`yp^aUSOu&^6Yq znH{Gjdy1ToM_18xy1^M=PdDinsf6NP{0v5Fpu=0V#$A)1#&bHX-X5Y5Y?Icb|Oislv3oU+Z6qWPg{PTS@w(Yz{} zhivmD(fmj>XKeFj(fn96XKnKp(Yz*_bGG@aXnrD^^R{_fG_Q;1VcR?-nm0uAh;1&2 z=1tK&YMW<8^Hb4$!Zy!|=4Yb$q-~xT&0C^*%r-BG=8|YWWt$g8^XK#hZx7g|mU!!k zcBylJ(!kL!6>TL&YVk+yduInKNW_?!<6#?t$}_%*oiCyD=P`o8VMr zPS)n!i{aqh1?RQQ$=RIyF&v!R;CwA}@;2u|3=UbU`!sa}T;o!RmobP1LNt?48!@+kGIN!^hF`M%!hJ)`e XaDI?Er)X9LjCkV*=Xh> literal 0 HcmV?d00001 diff --git a/build/com/hobogames/gameobj/entities/humans/Human.class b/build/com/hobogames/gameobj/entities/humans/Human.class new file mode 100644 index 0000000000000000000000000000000000000000..37896f765be9c9c93d0035b07d5cbd2ae9b8b506 GIT binary patch literal 818 zcma)3!A`1 literal 0 HcmV?d00001 diff --git a/build/com/hobogames/gameobj/entities/humans/Player.class b/build/com/hobogames/gameobj/entities/humans/Player.class new file mode 100644 index 0000000000000000000000000000000000000000..1e423c7db022699b0e7c798efa16a46bb7122ceb GIT binary patch literal 1794 zcmb7E>uwuG7(L_L+UqSzoumPhf>UVfI7ye5aA|V^S|~Au5}FcXt{vM;ys5owt=Coi z1Uvvg;Uz$^D}lrV@EAM@;(T7mG1O{>EPeCMH}hT2Iph8F@8A9au!j34=5Qs07jZR% z*Rf{e4ZJDax5T_H=9-x6V%EiMh}leIOV)QXco**(xM5-fH^sc4#s{+AlH(7>+cr_c zM`?VV#!eca7`ScVQ-#!q>$%~ULcXw5>9~!WUGPO!eTuaLOu z*Bph39oKVicbXL^xT`A-MshoT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W@yXZ zH|#ybv!oqgCWD4`X2yPC1gun+xFe6uL}^5!1jf$Ign7u6Sz<{hm2S6cB%ovu_(dh2olhs;dfaogU$xnW6(a-C9V4~&n7h8q}Du&&_+DguSw zhFO%9MawTbZcy}0qjor};H8FF*btce|H09487cl90|H~ z10A|jhi-;gNq0&#DJ=--I*N|tG|GIHlIz?hE+s4e%tL}PqrL#8Q_iW5^9=6A&dWr{ Z{i34X+@sLt(EHzB$w`nw?}yQ5{{S1yU1b0O literal 0 HcmV?d00001 diff --git a/build/com/hobogames/states/State.class b/build/com/hobogames/states/State.class new file mode 100644 index 0000000000000000000000000000000000000000..6453e8b72a52dbd33109f6168dab8301c800869a GIT binary patch literal 995 zcmah{U2oGs5S(+II0-IEQyN-mp)D;WDb#>?qvE9!0x5!rpa>pq=agLK*p)w!_*YO= zRRW10z>h-A*_LQa1b*1{?auDb&EC&n-+lmihNn$5uxnwjf%|ySgn?cIb@a6vXtQtO zp@l~Rwx7kZ4AW8Srcz*M=w&LHIDRyDW|0?7-MLJhL?;s`$2=FXW^OnMWGt|`5dNx2 z6KN#Az{>F0{pdPbssd-^yJ09}rs_%Nl|wrPAaKJeXT&O;GG9AXp-Nu}Z1w&*q(2rg zkD>|5w}vW|Z?d^3<9DtXFwz-Dz8j3)Sm|>aG}D<%Sfu+4RC>BYEjyXy0#sx;VW+7~ zk1h$b+v_i+aYdR|aP?tkLC~w{zMOp02mr7ryInqlw&{EpyU|nGO zFIg=d*l_Sz1D@Epj+PA@OE#LgMj`*VT7h=nGGD}7?^ycO=R#=oDM{s=TUDXJYOypG zIj_T$jPECw?wosD>n%+5$L2QQU4zflBqtIo|CVx3s=04tncf0dhZWizJiTXyLBBRQ zhZuZ^@!=GebC_qS4))Jb`@)=oRoV`b;I&P5@37-dw9#dxTh#Ncr?Qh)1;Qj-tdo$y ztoYxXPFu^PT_W$`Zi#g0HMTnV3hNK40=kwHu?qmUaw2tX Yb6jyrJx+gBQ5IjEQ)hCANdxzO0~zSj^Z)<= literal 0 HcmV?d00001 diff --git a/build/com/hobogames/utils/Choice.class b/build/com/hobogames/utils/Choice.class new file mode 100644 index 0000000000000000000000000000000000000000..46d986e682c6192efabb12697fea82a42ac647a0 GIT binary patch literal 1033 zcmaiy&2G~`6ot>ko@SC2Pc@<%}Irp_Pyo&&>6`=Y020zMg&_0Jw!}79&_0!L{h+<; zc;SK53L9b5J@9)@KMLACXEU}ZNV$B`{t_YuAp-uk1V-zT>+Ns5&tki{-&F&qK+bFV z-v0ez-}y_FD^DolaX3l)0-2^C{Vtd)S1z&$Wb0wS>-i4?)o(5Vzo|xQViaQnFp)u4 zVB+5~o5;a5v4#bK(*H*BSN)^Lp6^8r`Oo`qySLTsgk68r?fF>ZJ&*7&km5tvct;nm z5}XXi_#WqJi{FWcN&6FoZKY12+42kI3H0}I(FETXi$EDkp)6r73SD8uOiFp4XQ%Gu`EDdhPSSf$PhgW9QfRZF%SE8CmqzJSyj3#5S=1G5I^nD8^EoyWqE`4w~1 zs!ow@R|gx~ZJC$FBg|Fva{Z3JHmiR``ZaWUd?<|G!d!qJyG+xqgc&T;v5fhc zwZxohvJ}asvd*(E#;l5P4B9DjicA!KFi+qrm6A(xxT=nHl44! z6j9C7PpU@L|-5gJ(>|)Lwr`6h&t!E~O^(n_WhuOUnx{0!sRW4?X z-8mjdsQ;!zU0jKZ4d_*oz&hfm8ujzZ^ym+pR?*Hf)Zgj_gXk?OGkSh<4#!Mxk0_a%Iw;ykDGLwqFRV-=s^f{IV^nTlU%+ToKb5`O2 z6_HJ)WatI*v%yL1!fDFJ6bI3+DwesK<<(;G4i|&3L}lLK8ss&VNM&@>bdJR$$K3o$ z2H7-D+WZtUERMF{9v4GRCTnCScbcUces5HD>L^vpxM9y>b{Xz%_jVu1>!-Md&E!V42zd=y>4}74+Ef^HS!K%w-7F>CeZ*$>|KCMr%8v?h z9vv9q+)57jd6PkgFee|Qd&Kc3Q zK)oM~E~kyuZX#*7g8-D+Ww2PsCHTH}u$!r^BP>u0f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c8 z!Z2|U<0igPnf14f3!AR

s{Xm-wowV&9JR#l+X@)P?__a9hz!YxiZ5vkIcMfsTL) zbCv>`V^DDK)yX!7-R6VS3L4WUC7Qhk+IyQAY2AjtM!2R#0j|F#YhXl4V=nQcZU7xx z)vB!UawU&R_Ei`*8qf4%o)Z9DAW|$lHTvqZN~L_gT6JZuCh2ncsLL0#@GnA7m3PAP z5m<1oqQrT=8^e5ALNF9&xHA-xNW(-AA;LP5nJ6y$Ldo=_h9Uyb3rUl?ZV7X9AI=GU8{TOp4>&x z1iyGMmtFMbe1o0Cf2IzQO&(x?e0&Et(poa1?c&4^t^|_lw3g5o6Wa51gr*}c(|9_X zOhkQCU702#&vy`8;C68G7etZ85|-JalbA)RLCZ|~0lvfcLmYqF^4BIlxU5WBC=_B^}G3gU_{71G)HEn`Z8OB4>N%sB;xhW*M z3*!e&`;ClJn&M92P1@guc}Vw~j<@{Z+d8L?QT`!ZGUmA4;&+H%MB5CMkx(Y#L;4N{ RI$%b}WsQ!n&~XUw{0D1`fExe+ literal 0 HcmV?d00001 diff --git a/res/maps/Game1_tutorialMap.txt b/res/maps/Game1_tutorialMap.txt new file mode 100644 index 0000000..29fb22a --- /dev/null +++ b/res/maps/Game1_tutorialMap.txt @@ -0,0 +1,21 @@ +31 13 +room 20 1 3 3 +room 26 1 4 4 +room 13 5 7 4 +room 4 6 3 3 +hall 17 2 3 1 +hall 17 2 1 3 +hall 23 2 3 1 +hall 0 7 4 1 +hall 7 8 6 1 +hall 17 9 1 3 +switch 17 11 1 +lock_door 12 8 1 +exit 0 7 +enemy 5 7 +pillar 14 6 +pillar 18 6 +door 17 4 +lock_door 19 2 2 +p_plate 20 2 2 +torch 21 1 \ No newline at end of file diff --git a/res/texts/Game1_intro.txt b/res/texts/Game1_intro.txt new file mode 100644 index 0000000..b1ebaf8 --- /dev/null +++ b/res/texts/Game1_intro.txt @@ -0,0 +1,6 @@ +Dark and cold. +Nothing to be seen or heard. Only the feeling of a cold, rough stone. You lay there on the floor curled up. +For a moment, your existence seemed like a fluke. Nothing there to symbolize that you existed except for +the stone floor. Then you moved and sat up, feeling the floor around you for anything, but found nothing. +You reach out to all sides but felt only the air around your hand. You stand up feeling disorientated and +afraid. \ No newline at end of file diff --git a/res/texts/Game1_menuScreen.txt b/res/texts/Game1_menuScreen.txt new file mode 100644 index 0000000..84d4ec5 --- /dev/null +++ b/res/texts/Game1_menuScreen.txt @@ -0,0 +1,4 @@ +What would you like to do: + + 1. Play Game (p) + 2. Exit Game (q) \ No newline at end of file diff --git a/src/com/hobogames/Game.java b/src/com/hobogames/Game.java new file mode 100644 index 0000000..d196241 --- /dev/null +++ b/src/com/hobogames/Game.java @@ -0,0 +1,51 @@ +package build.com.hobogames; + +import build.com.hobogames.states.*; + +public class Game { + + private boolean gameOn; + + private Handler handler; + private State menuState; + private State playState; + + public Game() { + + } + + public void init() { + gameOn = true; + + handler = new Handler(this); + menuState = new MenuState(handler); + playState = new PlayState(handler); + State.setCurrentState(menuState); + State.getCurrentState().init(); + + } + + public void gameLoop() { + init(); + + while (gameOn) { + if (State.getCurrentState() != null) { + State.getCurrentState().update(); + } + System.out.println("\n----------------\n"); + + } + + end(); + } + + public void end() { + System.out.println("Exiting game."); + } + + public boolean getGameOn() {return gameOn;} + public MenuState getMenuState() {return (MenuState)menuState;} + public PlayState getPlayState() {return (PlayState)playState;} + + public void setGameOn(boolean gameOn) {this.gameOn = gameOn;} +} \ No newline at end of file diff --git a/src/com/hobogames/Handler.java b/src/com/hobogames/Handler.java new file mode 100644 index 0000000..69c82ea --- /dev/null +++ b/src/com/hobogames/Handler.java @@ -0,0 +1,26 @@ +package build.com.hobogames; + +import build.com.hobogames.states.*; +import build.com.hobogames.gameobj.entities.humans.Player; +import java.util.Random; +import java.util.Scanner; + +public class Handler { + + private Game game; + public Random rand; + public Scanner sc; + + public Handler(Game game) { + this.game = game; + this.rand = new Random(); + sc = new Scanner(System.in); + } + + public Game getGame() {return game;} + public boolean getGameOn() {return game.getGameOn();} + public MenuState getMenuState() {return game.getMenuState();} + public PlayState getPlayState() {return game.getPlayState();} + public Player getPlayer() {return getPlayState().getPlayer();} + +} \ No newline at end of file diff --git a/src/com/hobogames/gameobj/GOHandler.java b/src/com/hobogames/gameobj/GOHandler.java new file mode 100644 index 0000000..54d5e0a --- /dev/null +++ b/src/com/hobogames/gameobj/GOHandler.java @@ -0,0 +1,23 @@ +package build.com.hobogames.gameobj; + +import build.com.hobogames.Handler; +import build.com.hobogames.gameobj.GameObject; +import java.util.ArrayList; + +public class GOHandler { + + private Handler handler; + private ArrayList gameObjects; + + public GOHandler(Handler handler) { + this.handler = handler; + } + + public void update() { + for (int i = 0; i < gameObjects.size(); i++) { + if (gameObjects.get(i) != null) { + gameObjects.get(i).update(); + } + } + } +} \ No newline at end of file diff --git a/src/com/hobogames/gameobj/GameObject.java b/src/com/hobogames/gameobj/GameObject.java new file mode 100644 index 0000000..30a55e6 --- /dev/null +++ b/src/com/hobogames/gameobj/GameObject.java @@ -0,0 +1,35 @@ +package build.com.hobogames.gameobj; + +import build.com.hobogames.Handler; + +public abstract class GameObject { + + protected Handler handler; + protected int posX, posY; + protected String name; + protected int gameId; + public static int idNum = 0; + + public GameObject(Handler handler) { + this.handler = handler; + posX = 0; + posY = 0; + idNum++; + gameId = idNum; + } + + public abstract void init(); + public abstract void update(); + public abstract void end(); + + public int getPosX() {return posX;} + public int getPosY() {return posY;} + public String getName() {return name;} + public int getGameId() {return gameId;} + + public void setPosX(int posX) {this.posX = posX;} + public void setPosY(int posY) {this.posY = posY;} + public void setName(String name) {this.name = name;} + public void setGameId(int id) {this.gameId = id;} + +} \ No newline at end of file diff --git a/src/com/hobogames/gameobj/entities/Entity.java b/src/com/hobogames/gameobj/entities/Entity.java new file mode 100644 index 0000000..9267592 --- /dev/null +++ b/src/com/hobogames/gameobj/entities/Entity.java @@ -0,0 +1,65 @@ +package build.com.hobogames.gameobj.entities; + +import build.com.hobogames.gameobj.GameObject; +import build.com.hobogames.Handler; + +public abstract class Entity extends GameObject { + + protected int dir; + protected int health, maxHealth; + protected int stamina, maxStamina; + protected int attack, defense, speed; + protected int blockChance, dodgeChance, hitChance; + protected int xp, level; + + //attributes + protected int strength, agility, endurance, intelligence, perception, charisma, luck; + + //protected Trait[] traits = new Trait[40] + //protected Skill[] skills = new Skills[20] + + public Entity(Handler handler) { + super(handler); + } + + public abstract void move(int moveX, int moveY); + public abstract void attack(); + + public int getDir() {return dir;} + public int getHealth() {return health;} + public int getMaxHealth() {return maxHealth;} + public int getAttack() {return attack;} + public int getDefense() {return defense;} + public int getSpeed() {return speed;} + public int getBlockChance() {return blockChance;} + public int getDodgeChance() {return dodgeChance;} + public int getHitChance() {return hitChance;} + public int getXp() {return xp;} + public int getLevel() {return level;} + public int getStrength() {return strength;} + public int getAgility() {return agility;} + public int getEndurance() {return endurance;} + public int getIntelligence() {return intelligence;} + public int getPerception() {return perception;} + public int getCharisma() {return charisma;} + public int getLuck() {return luck;} + + public void setDir(int dir) {this.dir = dir;} + public void setHealth(int health) {this.health = health;} + public void setMaxHealth(int maxHealth) {this.maxHealth = maxHealth;} + public void setAttack(int attack) {this.attack = attack;} + public void setDefense(int defense) {this.defense = defense;} + public void setSpeed(int speed) {this.speed = speed;} + public void setBlockChance(int blockChance) {this.blockChance = blockChance;} + public void setDodgeChance(int dodgeChance) {this.dodgeChance = dodgeChance;} + public void setHitChance(int hitChance) {this.hitChance = hitChance;} + public void setXp(int xp) {this.xp = xp;} + public void setLevel(int level) {this.level = level;} + public void setStrength(int strength) {this.strength = strength;} + public void setAgility(int agility) {this.agility = agility;} + public void setEndurance(int endurance) {this.endurance = endurance;} + public void setIntelligence(int intelligence) {this.intelligence = intelligence;} + public void setPerception(int perception) {this.perception = perception;} + public void setCharisma(int charisma) {this.charisma = charisma;} + public void setLuck(int luck) {this.luck = luck;} +} \ No newline at end of file diff --git a/src/com/hobogames/gameobj/entities/humans/Human.java b/src/com/hobogames/gameobj/entities/humans/Human.java new file mode 100644 index 0000000..888c85f --- /dev/null +++ b/src/com/hobogames/gameobj/entities/humans/Human.java @@ -0,0 +1,38 @@ +package build.com.hobogames.gameobj.entities.humans; + +import build.com.hobogames.Handler; +import build.com.hobogames.gameobj.entities.Entity; + +public class Human extends Entity { + + + public Human(Handler handler) { + super(handler); + } + + @Override + public void init() { + + } + + @Override + public void update() { + + } + + @Override + public void end() { + + } + + @Override + public void move(int moveX, int moveY) { + + } + + @Override + public void attack() { + + } + +} \ No newline at end of file diff --git a/src/com/hobogames/gameobj/entities/humans/Player.java b/src/com/hobogames/gameobj/entities/humans/Player.java new file mode 100644 index 0000000..351ec33 --- /dev/null +++ b/src/com/hobogames/gameobj/entities/humans/Player.java @@ -0,0 +1,46 @@ +package build.com.hobogames.gameobj.entities.humans; + +import build.com.hobogames.gameobj.entities.humans.Human; +import build.com.hobogames.Handler; + +public class Player extends Human { + + + public Player(Handler handler) { + super(handler); + + } + + @Override + public void init() { + dir = handler.rand.nextInt(4); + maxHealth = 20; health = maxHealth; + maxStamina = 20; stamina = 20; + posX = 0; posY = 0; + name = "Player"; + System.out.println(dir + " " + health + " " + stamina + " " + posX + posY + " " + name + " " + gameId); + System.out.println("Player is created!"); + } + + @Override + public void update() { + + } + + @Override + public void end() { + + } + + @Override + public void move(int moveX, int moveY) { + posX += moveX; + posY += moveY; + System.out.println("Player X: " + posX + " Y: " + posY); + } + + @Override + public void attack() { + + } +} \ No newline at end of file diff --git a/src/com/hobogames/gameobj/nonentities/Wall.java b/src/com/hobogames/gameobj/nonentities/Wall.java new file mode 100644 index 0000000..d607974 --- /dev/null +++ b/src/com/hobogames/gameobj/nonentities/Wall.java @@ -0,0 +1,28 @@ +package build.com.hobogames.gameobj.nonentities; + +import build.com.hobogames.Handler; +import build.com.hobogames.gameobj.GameObject; + +public class Wall extends GameObject{ + + + public Wall(Handler handler) { + super(handler); + } + + @Override + public void init() { + + } + + @Override + public void update() { + + } + + @Override + public void end() { + + } + +} \ No newline at end of file diff --git a/src/com/hobogames/states/MenuState.java b/src/com/hobogames/states/MenuState.java new file mode 100644 index 0000000..40e673c --- /dev/null +++ b/src/com/hobogames/states/MenuState.java @@ -0,0 +1,60 @@ +package build.com.hobogames.states; + +import build.com.hobogames.utils.Choice; +import build.com.hobogames.utils.ReadFile; +import build.com.hobogames.Handler; + +public class MenuState extends State { + + + public MenuState(Handler handler) { + super(handler); + } + + @Override + public void init() { + subState = "Main"; + } + + @Override + public void update() { + switch (subState) { + case "Main": + + ReadFile.setPath("res/texts/Game1_menuScreen.txt"); + System.out.print(ReadFile.getText() + "\n -> "); + Choice[] menuChoices = { + new Choice("Play", new String[]{"1", "Play", "Play Game", "p"}), + new Choice("Exit", new String[]{"2", "Exit", "Exit Game", "q"}) + }; + String choice = sc.nextLine(); + + for (int i = 0; i < menuChoices.length; i++) { + if (menuChoices[i].checkAnswer(choice)) { + subState = menuChoices[i].getAnswer(); + break; + } + subState = choice; + } + + break; + case "Play": + end(); + State.setCurrentState(handler.getPlayState()); + State.getCurrentState().init(); + break; + case "Exit": + if (handler.getGameOn()) {handler.getGame().setGameOn(false);} + break; + default: + System.out.println("String:subState does not match any choices. Setting to main."); + subState = "Main"; + break; + } + } + + @Override + public void end() { + + } +} \ No newline at end of file diff --git a/src/com/hobogames/states/PlayState.java b/src/com/hobogames/states/PlayState.java new file mode 100644 index 0000000..50a697e --- /dev/null +++ b/src/com/hobogames/states/PlayState.java @@ -0,0 +1,43 @@ +package build.com.hobogames.states; + +import build.com.hobogames.Handler; +import build.com.hobogames.gameobj.entities.humans.Player; +import build.com.hobogames.utils.Controller; +import build.com.hobogames.utils.Map; + +public class PlayState extends State { + + private Player player; + private Controller controls; + private Map map; + + public PlayState(Handler handler) { + super(handler); + } + + @Override + public void init() { + System.out.println("The game is not ready."); + player = new Player(handler); + controls = new Controller(handler); + map = new Map(handler); + player.init(); + controls.init(); + map.init(); + } + + @Override + public void update() { + controls.update(); + map.displayMap(); + } + + @Override + public void end() { + + } + + public Player getPlayer() {return player;} + + public void setPlayer(Player player) {this.player = player;} +} \ No newline at end of file diff --git a/src/com/hobogames/states/State.java b/src/com/hobogames/states/State.java new file mode 100644 index 0000000..581e880 --- /dev/null +++ b/src/com/hobogames/states/State.java @@ -0,0 +1,25 @@ +package build.com.hobogames.states; + +import build.com.hobogames.Handler; +import java.util.Scanner; + +public abstract class State { + + protected static State currentState = null; + protected Handler handler; + + protected Scanner sc = new Scanner(System.in); + protected String subState; + + public State(Handler handler) { + this.handler = handler; + } + + public abstract void init(); + public abstract void update(); + public abstract void end(); + + public static State getCurrentState() {return currentState;} + + public static void setCurrentState(State state) {State.currentState = state;} +} \ No newline at end of file diff --git a/src/com/hobogames/utils/Choice.java b/src/com/hobogames/utils/Choice.java new file mode 100644 index 0000000..1434dd8 --- /dev/null +++ b/src/com/hobogames/utils/Choice.java @@ -0,0 +1,32 @@ +package build.com.hobogames.utils; + + +public class Choice { + + private String answer; + private String[] choices; + + public Choice() { + answer = ""; + choices = new String[1]; + } + public Choice(String answer, String[] choices) { + this.answer = answer; + this.choices = new String[choices.length]; + for (int i=0; i < choices.length; i++) { + this.choices[i] = choices[i]; + } + } + + public boolean checkAnswer(String choice) { + for (String c : choices) { + if (choice.equalsIgnoreCase(c)) { + return true; + } + } + return false; + } + + public String getAnswer() {return answer;} + +} \ No newline at end of file diff --git a/src/com/hobogames/utils/Controller.java b/src/com/hobogames/utils/Controller.java new file mode 100644 index 0000000..7bbc511 --- /dev/null +++ b/src/com/hobogames/utils/Controller.java @@ -0,0 +1,54 @@ +package build.com.hobogames.utils; + +import build.com.hobogames.Handler; +import build.com.hobogames.utils.Choice; +import build.com.hobogames.states.State; + +public class Controller { + + private Handler handler; + + private Choice[] moveChoice; + + public Controller(Handler handler) { + this.handler = handler; + } + + public void init() { + moveChoice = new Choice[]{ + new Choice("move north", new String[]{"move north", "north", "walk north", "n"}), + new Choice("move east", new String[]{"move east", "east", "walk east", "e"}), + new Choice("move south", new String[]{"move south", "south", "walk south", "s"}), + new Choice("move west", new String[]{"move west", "west", "walk west", "w"}), + new Choice("quit", new String[]{"quit", "q"}) + }; + } + + public void update() { + System.out.print(" -> "); + String choice = handler.sc.nextLine(); + + for (Choice c : moveChoice) { + if (c.checkAnswer(choice)) { + choice = c.getAnswer(); + } + } + + switch (choice) { + case "move north": handler.getPlayer().move(0,1);break; + case "move east":handler.getPlayer().move(1,0);break; + case "move south": handler.getPlayer().move(0,-1);break; + case "move west": handler.getPlayer().move(-1,0);break; + case "quit": + System.out.println("Quiting the game"); + handler.getPlayState().end(); + State.setCurrentState(handler.getMenuState()); + State.getCurrentState().init(); + break; + default: + System.out.println("Unknown choice."); + } + } + + +} \ No newline at end of file diff --git a/src/com/hobogames/utils/Map.java b/src/com/hobogames/utils/Map.java new file mode 100644 index 0000000..967fc87 --- /dev/null +++ b/src/com/hobogames/utils/Map.java @@ -0,0 +1,90 @@ +package build.com.hobogames.utils; + +import build.com.hobogames.Handler; +import java.lang.Integer; + +public class Map { + + private Handler handler; + private String[][] mapData; + + public Map(Handler handler) { + this.handler = handler; + } + + public void init() { + buildMap(); + } + + public void buildMap() { + ReadFile.setPath("res/maps/Game1_tutorialMap.txt"); + String[] mapFile = ReadFile.getText().split("\n"); + + mapData = new String[Integer.parseInt(mapFile[0].split(" ")[1])][Integer.parseInt(mapFile[0].split(" ")[0])]; + + for (int k = 0; k < mapFile.length; k++) { + String[] object = mapFile[k].split(" "); + switch (object[0]) { + case "room": + for (int j = 0; j < Integer.parseInt(object[4]); j++) { + for (int i = 0; i < Integer.parseInt(object[3]); i++) { + mapData[j + Integer.parseInt(object[2])][i + Integer.parseInt(object[1])] = "."; + } + } + break; + case "hall": + for (int j = 0; j < Integer.parseInt(object[4]); j++) { + for (int i = 0; i < Integer.parseInt(object[3]); i++) { + mapData[j + Integer.parseInt(object[2])][i + Integer.parseInt(object[1])] = "."; + } + } + break; + case "switch": + mapData[Integer.parseInt(object[2])][Integer.parseInt(object[1])] = "S"; + break; + case "lock_door": + mapData[Integer.parseInt(object[2])][Integer.parseInt(object[1])] = "D"; + break; + case "exit": + mapData[Integer.parseInt(object[2])][Integer.parseInt(object[1])] = "E"; + break; + case "enemy": + mapData[Integer.parseInt(object[2])][Integer.parseInt(object[1])] = "@"; + break; + case "pillar": + mapData[Integer.parseInt(object[2])][Integer.parseInt(object[1])] = "#"; + break; + case "door": + mapData[Integer.parseInt(object[2])][Integer.parseInt(object[1])] = "D"; + break; + case "p_plate": + mapData[Integer.parseInt(object[2])][Integer.parseInt(object[1])] = "^"; + break; + } + } + 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 && i+1 != mapData[j].length && + (mapData[j+1][i] != null || mapData[j][i+1] != null)) { + mapData[j][i] = "#"; + } else if (j-1 != -1 && i-1 != -1 && + (mapData[j-1][i] != null || mapData[j][i-1] != null) && + (mapData[j-1][i] != "#" || mapData[j][i-1] != "#")) { + mapData[j][i] = "#"; + } else + mapData[j][i] = " "; + } + } + } + } + + public void displayMap() { + for (int j = 0; j < mapData.length; j++) { + for (int i = 0; i < mapData[j].length; i++) { + System.out.print(" " + mapData[j][i]); + } + System.out.println(); + } + } +} \ No newline at end of file diff --git a/src/com/hobogames/utils/ReadFile.java b/src/com/hobogames/utils/ReadFile.java new file mode 100644 index 0000000..6410d4a --- /dev/null +++ b/src/com/hobogames/utils/ReadFile.java @@ -0,0 +1,41 @@ +package build.com.hobogames.utils; + +import java.io.BufferedReader; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.io.File; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.FileReader; + +public class ReadFile { + + private static File fileToRead; + private static Path pathToFile; + + + public ReadFile() { + + } + + public static void setPath(String path) { + pathToFile = Paths.get(path); + fileToRead = pathToFile.toFile(); + } + + public static String getText() { + String line = ""; + String text = ""; + try (BufferedReader reader = new BufferedReader(new FileReader(fileToRead))) { + line = reader.readLine(); + while (line != null) { + text += line + "\n"; + line = reader.readLine(); + } + } catch (IOException ex) { + ex.printStackTrace(); + } + return text; + } + +}