-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathGame.sh
More file actions
3602 lines (3468 loc) · 104 KB
/
Game.sh
File metadata and controls
3602 lines (3468 loc) · 104 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
# The script Game.sh was created by mason1600 on GitHub released with the license GNU General Public License v3.0
# This Bash Script Is A Work Of True Passion For My Love For Bash And Gaming, Enjoy.
# This variable is created with a value of 99 for bobs health.
BOBS_HEALTH=99
# This variable is created with a value of 1 for bobs coins to be collected.
COIN=1
# Intro for game.
# The cat command is used to print everything between the two EOFs stands for end of file.
cat << EOF
-x-
This Is Bob!!!
o
- X - Bobs Health..100mana
t
Bob Is On An Adventure!!
EOF
# Echo command informs user that hitting enter will move on if no selection is given.
echo "Hitting Enter Moves On IF NO Selection."
# Read command used to hold user till press of enter.
read first
# The cat command used again.
cat << EOF
!
0
-- Mana 65 ow took a hit!
MaTriX GlItCh
x
t
Ohhh Bob Got All Messed Up How Can We Fix This???
EOF
# The Read command used to pause again till enter press.
read second
# The cat command used again.
cat << EOF
Alright Lets Fix Him.
EOF
# The read command to pause.
read secondsecond
# Another cat command.
cat << EOF
o Mana 100
-X-
t
Alright. We Fixed Him. Health Restored!
EOF
# Using read to pause again.
read THIRD
# End of intro.
# First level of game introducing health.
# First function created called level1 containing all of level one.
level1(){
# The cat command used again.
cat << EOF
-x-
This Is Bob.
o
- X - Bobs Health.. $BOBS_HEALTH Mana
t
YOU Are Now Bob!!
EOF
# This pauses again using read.
read fourth
# The cat command again to print.
cat << EOF
BOB
o
- X - Bobs Health..$BOBS_HEALTH Mana
t
EOF
}
# End level of level one.
# Typing level1 directly below the function calls that function named level1.
level1
# The echo command echos begin level two.
echo "Begin LvL 2"
# This uses read to pause again till enter press.
read fourth
# This is the beginning of the second level.
# This creates second function named level2.
level2(){
# The cat command used once again.
cat << EOF
o
-X-
t
$BOBS_HEALTH Mana
You Will Need FOOD To Recover Mana.
EOF
# Pauses using read command.
read extra
# This is the main moving animation for the game.
# This uses mainly the cat command and sleep to pause for half a second between frames.
animation(){
cat << EOF
o
-X-
...t....................
EOF
sleep .5
cat << EOF
o
-X-
t
.......................
EOF
sleep .5
cat << EOF
o
-X-
....t....................
EOF
sleep .5
cat << EOF
o
-X-
...t....................
EOF
sleep .5
cat << EOF
o
-X-
t
.......................
EOF
sleep .5
cat << EOF
o
-X-
....t....................
EOF
sleep .5
cat << EOF
o
-X-
...t....................
EOF
sleep .5
cat << EOF
o
-X-
t
.......................
EOF
sleep .5
cat << EOF
o
-X-
....t....................
EOF
sleep .5
cat << EOF
o
-X-
...t....................
EOF
sleep .5
cat << EOF
o
-X-
t
.......................
EOF
sleep .5
cat << EOF
o
-X-
....t....................
EOF
sleep .5
}
# Call it by typing its function name.
animation
# This is a little trick to keep the user from accidentally pressing ''enter'' during the animation.
# This would Give blank input to the next read. Witch would be bad. So 1-3 traps should be safe.
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
# The cat command used again.
cat << EOF
o tttt
-X- tttttt <---Tree
t tt Nearby
.........................tt..................
$BOBS_HEALTH Mana
Type eat to eat Apple From Nearby Tree To Recover 1 Mana.
EOF
# Using read to pause.
read eat
# The cat command again.
cat << EOF
o
-X-
t
$((BOBS_HEALTH += 1)) Mana
Nice He Recovered Woot!
EOF
# The read command to pause till enter press.
read extra
# This calls the animation function again.
animation
# This is a little trick to keep the user from accidentally pressing ''enter'' during the animation.
# This would Give blank input to the next read. Witch would be bad. So 1-3 traps should be safe.
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
# The cat command again.
cat << EOF
o o
-X- -X-
t jj
..............................
There is another Human could be Dangerous say Hello?
EOF
# This takes bobs health and subtracts a random number from 1-7.
((BOBS_HEALTH-=$(($RANDOM % 7 + 1))))
# The read to pause again.
read hi
# Using cat to print again.
cat << EOF
o o
-X- -X-
t jj
..............................
$BOBS_HEALTH Mana
He was a bad guy it seems we had to kill him
and now we have sustained damage.
EOF
# More cat command.
cat << EOF
o
-X-
t oIjj
..................................
Lets bury the guy.
EOF
# And pause with read.
read sixth
# And cat agian.
cat << EOF
o ..
-X- ....
t ......
..................................
Alright buryed him under some dirt.
$BOBS_HEALTH Mana
EOF
# Using Read to hold till enter press.
read seventh
# Calls the animation again.
animation
# This is a little trick to keep the user from accidentally pressing ''enter'' during the animation.
# This would Give blank input to the next read. Witch would be bad. So 1-3 traps should be safe.
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
# End of level two.
}
# This calls level2 function.
level2
# Beginning of level three.
# This creates level3 function.
level3(){
# This echos intro for lvl 3.
echo "Welcome To LEVEL 3 I Can't Believe You Made It This Far!"
# The cat command again.
cat << EOF
BBBB
o BBiBBB
-X-A Bird---->^V^ BBiiiiBB
t BiiiiiB
.........................iiiii.....
A Tree Grows Suddenly Out Of The Dirt As A Bird Flys By Weird?
$BOBS_HEALTH Mana
EOF
# The read command.
read eighth
# The cat command.
cat << EOF
BBBB
o i BBiBBB
-X-A Apple-->@ BBiiiiBB
t BiiiiiB
.........................iiiii.....
$BOBS_HEALTH Mana
The Tree Grabs The Bird Eats It and Spits Out A Apple Do You Eat It? yes or no?
EOF
# Using read to pause and ask.
read NINTH
# Then using a if then else statement to check.
if [[ $NINTH == yes ]]; then
# Call it.
((BOBS_HEALTH += 1))
elif [[ $NINTH == no ]]; then
((BOBS_HEALTH -= 2))
else
# Answer does not exist, handle the situation (e.g., print an error).
echo "Error: $NINTH does not exist." "Do to USER Error the app will close with press of Enter."
# Prints an error and holds user for them to read then closes with press of enter.
read error
# Another exit code.
exit
# Ends the if statement by typing if backwards or fi.
fi
# After any time subtraction is used on bobs health must check for death.
# Less important at the beggining of the game, but need as you go deeper.
if [ $BOBS_HEALTH -lt 1 ]; then
echo "This is the end you have died."
read dededededed
# This will exit if they are dead.
exit
# Else it will continue with woot.
else echo "still alive woot"
fi
# The cat command used again.
cat << EOF
BBBB
o BBiBBB
-X- BBiiiiBB
t BiiiiiB
.........................iiiii.....
$BOBS_HEALTH Mana
The result of either eating the apple or not is?good or bad?
EOF
# The read command to pause and ask.
read TENTH
# Then using a if then else statement to check.
if [[ $TENTH == good ]]; then
# Call it.
echo "ya its YUM it grew from the finest dirts and herbs and minerls of the earth."
sleep 2
elif [[ $TENTH == bad ]]; then
echo "well you probly shuld have ate it then duhhh lol XD"
sleep 1
else
# Answer does not exist, handle the situation (e.g., print an error).
echo "Error: $TENTH does not exist." "Do to user error the app will close with press of enter."
# Prints an error and holds user for them to read then closes with press of enter.
read error2
# Another exit code.
exit
# Ends the if statement by typing if backwards or fi.
fi
# The cat command.
cat << EOF
BBBB
o t i tt BBiBBB
-X- tit BBiiiiBB
t ti<-Ded Tree BiiiiiB
...............i..............iiiii.....
$BOBS_HEALTH Mana
We now continue on our path to whereever we are going-->
EOF
# Using read to pause.
read eleventh
# Calls the animation agian.
animation
# This is a little trick to keep the user from accidentally pressing ''enter'' during the animation.
# This would Give blank input to the next read. Witch would be bad. So 1-3 traps should be safe.
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
# The cat command again.
cat << EOF
o
-X-@ Found It Here--v
t v
.............................v....
$BOBS_HEALTH Mana
$COIN Coins
Hey you found your first coin woot!
EOF
# Using read to pause.
read thirteenth
# Calls the animation.
animation
# This is a little trick to keep the user from accidentally pressing ''enter'' during the animation.
# This would Give blank input to the next read. Witch would be bad. So 1-3 traps should be safe.
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
# The cat command.
cat << EOF
@<--Fruit
o t i tt
-X- tit
t ti<-Ded Tree
...............i..............
$BOBS_HEALTH Mana
$COIN Coins
There is a ded tree with one fruit left on it do you eat it? yes or no?
EOF
# Using read to pause and ask.
read FOURTEENTH
# Then using a if then else statement to check.
if [[ $FOURTEENTH == yes ]]; then
# Call it.
((BOBS_HEALTH -= 11))
elif [[ $FOURTEENTH == no ]]; then
((BOBS_HEALTH -= 1))
else
# Function does not exist, handle the situation (e.g., print an error).
echo "Error: $FOURTEENTH does not exist." "do to user error the app will close with press of enter"
# Prints an error and holds user for them to read then closes with press of enter.
read error
# Another exit code.
exit
# Ends the if statement by typing if backwards or fi.
fi
# Check for death.
if [ $BOBS_HEALTH -lt 1 ]; then
echo "This is the end you have died."
read dededededed
exit
# Move on if still alive.
else echo "still alive woot"
fi
# The cat command used again.
cat << EOF
o. Blah
-X- . . <--Vomit
......t......j................
$BOBS_HEALTH Mana
$COIN Coins
It was extremly toxic if you ate it other wise hunger takes 1 health anyway.
EOF
# Using read to pause.
read fiveteen
# Calls the animation.
animation
# This is a little trick to keep the user from accidentally pressing ''enter'' during the animation.
# This would Give blank input to the next read. Witch would be bad. So 1-3 traps should be safe.
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
# End of level 3.
}
# Calls level3 function.
level3
# Beginning of level 4.
echo "CONGRATS YOU MADE IT TO LEVEL 4"
# Waits for user input to move on to level 4 ,example enter.
read sixteen
# This creates level4 as a function.
level4(){
# The cat command shows the user rain drops.
cat << EOF
d<---Rain Drops
d d
d o d
d -X- d
......t......................
$BOBS_HEALTH Mana
$COIN Coins
Now that your done voming you look up and see rain.
EOF
# Using read to hold till enter press.
read eightteenth
((BOBS_HEALTH += 3)) # This adds 3 health to bob.
# The cat command again.
cat << EOF
d<---Rain Drops
d d
d o d
d -X- d
......t......................
$BOBS_HEALTH Mana
$COIN Coins
The rain is clean and good and gives you 3 health nice woot!
EOF
# Using read to hold till enter press.
read nineteenth
# Calls the animation.
animation
# This is a little trick to keep the user from accidentally pressing ''enter'' during the animation.
# This would Give blank input to the next read. Witch would be bad. So 1-3 traps should be safe.
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
# The cat command again.
cat << EOF
............................
.. . . . . .
o . .<-left right->or forward
-X- . . . . . . .
......t......................
$BOBS_HEALTH Mana
$COIN Coins
You come to a crossroads given a choice left right or forward?
EOF
# The read command used to pause and ask.
read aa
# A if then elif else fi conditional statement.
if [ $aa == left ]; then
# Subtracts health from bob.
((BOBS_HEALTH -= 30))
# The cat command used again.
cat << EOF
.... ................... .....
..... xxxxx....................... x......
..... xxxx....xxxxxxx..... xx....... ..
..................................xxxx......
..o..Ouch...Pitfalls.............xxxxx.......
.-X-....... xxxx..... xxxxxx.................
..t.. xxxxx ................................
$BOBS_HEALTH Mana
$COIN Coins
You fall into a pitfall and take substantial damage!
EOF
# The read command used to pause and ask.
read cc
elif [ $aa == right ]; then
# Adds health to bob.
((BOBS_HEALTH += 4))
# Adds coin.
((COIN += 1))
# The cat command used again.
cat << EOF
..............................................
xxxx
i <-Tree @ <-Coin
i
o q qqq
-X- qqq <-Veggies
.....t...........................................
$BOBS_HEALTH Mana
$COIN Coins
You go down a nice path and find fresh veggies and a coin.
EOF
# The read command.
read dd
elif [ $aa == forward ]; then
# The cat command for nothing here.
cat << EOF
...............................................
o -...> Theres Nothing Here
-X-
t
$BOBS_HEALTH Mana
$COIN Coins
...............................................
Its just a empty path? Ugh Sigh...
EOF
# The read command used again.
read ee
else echo "Invalid choice you lose."
# The read again.
read bb
# A exit command for lack of focus.
exit
# This ends a if statement by typing fi.
fi
# Check for death.
if [ $BOBS_HEALTH -lt 1 ]; then
# A echo command used here.
echo "This is the end you have died."
# The read command used again to pause.
read dededededed
# Another exit command for death check.
exit
# Move on if still alive.
else echo "still alive woot"
# This ends a if statement by typing fi.
fi
# This calls the animation function.
animation
# This is a little trick to keep the user from accidentally pressing ''enter'' during the animation.
# This would Give blank input to the next read. Witch would be bad. So 1-3 traps should be safe.
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
# The cat command used again.
cat << EOF
$BOBS_HEALTH Mana
$COIN Coins -X- Sun
o c Chest
-X- j---j
....t..................---.................
Whats this ? Oh a treasure chest i think?
Should i open it?yes or no?
EOF
# Using read to pause and ask.
read ee
# A if conditional statement.
if [ $ee == yes ]; then
# This adds a coin.
((COIN += 1))
# This adds to bobs health.
((BOBS_HEALTH += 1))
# The cat command used again.
cat << EOF
$BOBS_HEALTH Mana
$COIN Coins -X- Sun
o - Chest Open
-X- i@ -j
.............. .......t.---.................
Its seems there is a coin and a crunchy pickle inside.
I will take the coin and crunch the pickle.
EOF
# The read command to pause.
read ff
# Then else if no then animation.
elif [ $ee == no ]; then
# The animation again.
animation
# This is a little trick to keep the user from accidentally pressing ''enter'' during the animation.
# This would Give blank input to the next read. Witch would be bad. So 1-3 traps should be safe.
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
# This will use the echo command to inform user.
else echo "No not a proper command."
# This will pause using read.
read ff
# This will exit do to lack of focus.
exit
# This ends the if statement.
fi
# This calls the animation function.
animation
# This is a little trick to keep the user from accidentally pressing ''enter'' during the animation.
# This would Give blank input to the next read. Witch would be bad. So 1-3 traps should be safe.
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
# The cat command used again.
cat << EOF
$BOBS_HEALTH Mana
$COIN Coins
o o
-X- t-X-O
..........t...............jj...........
Oh no this warrior wants to do battle!
EOF
# Using read to pause.
read gg
# The cat command again.
cat << EOF
$BOBS_HEALTH Mana
$COIN Coins
$(($RANDOM % 5 + 1))dmg
o o
-X- t-X-O
..........t...............jj...........
Prepare for battle!
You do damage!
EOF
# Using read command to pause.
read hh
# This will minus 3 health from bob.
((BOBS_HEALTH -= 3 ))
# The cat command used again.
cat << EOF
$BOBS_HEALTH Mana
$COIN Coins
3 dmg
o o
-X- t-X-O
..........t...............jj...........
Prepare for battle!
He does damage!
EOF
# Using read to pause.
read ii
# Check for death.
if [ $BOBS_HEALTH -lt 1 ]; then
# The echo command to inform user.
echo "This is the end you have died."
# The read command.
read dededededed
# The exit command used again.
exit
# Move on if still alive.
else echo "still alive woot"
# Ends the if statement.
fi
# The cat command used again.
cat << EOF
$BOBS_HEALTH Mana
$COIN Coins
$(($RANDOM % 5 + 1))dmg
o o
-X- t-X-O
..........t...............jj...........
Prepare for battle!
You do damage!
EOF
# Using read to pause.
read jj
# The cat command again.
cat << EOF
$BOBS_HEALTH Mana
$COIN Coins
$(($RANDOM % 5 + 1))dmg
o o
-X- t-X-O
..........t...............jj...........
Prepare for battle!
You do damage again!
EOF
# Using read to pause.
read kk
# The cat command.
cat << EOF
$BOBS_HEALTH Mana
$COIN Coins
o Dead
-X- oxg Warrior
..........t...............jj...........
He dies quick must have been a noob with no hax.
EOF
# Using read to pause.
read ll
# calls the animation.
animation
# This is a little trick to keep the user from accidentally pressing ''enter'' during the animation.
# This would Give blank input to the next read. Witch would be bad. So 1-3 traps should be safe.
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
# The cat command to print again.
cat << EOF
............................
.. . . . . .
o . .<-left right->or forward
-X- . . . . . . .
......t......................
$BOBS_HEALTH Mana
$COIN Coins
You come to a crossroads given a choice left right or forward?
EOF
# The read command used again.
read aa
# This is a if,then,elif,else,fi conditional statement.
if [ $aa == right ]; then
# This will minus 30 health from bob.
((BOBS_HEALTH -= 30))
# This cats out the pitfall choice.
cat << EOF
.... ................... .....
..... xxxxx....................... x......
..... xxxx....xxxxxxx..... xx....... ..
..................................xxxx......
..o..Ouch...Pitfalls.............xxxxx.......
.-X-....... xxxx..... xxxxxx.................
..t.. xxxxx ................................
$BOBS_HEALTH Mana
$COIN Coins
You fall into a pitfall and take substantial damage.
EOF
# Using read to hold.
read cc
# This is else if choice is left then.
elif [ $aa == left ]; then
# Adds 4 health to bob.
((BOBS_HEALTH += 4))
# Adds 1 coin.
((COIN += 1))
# This cats out nice path choice.
cat << EOF
..............................................
xxxx
i <-Tree @ <-Coin
i
o q qqq
-X- qqq <-Veggies
.....t...........................................
$BOBS_HEALTH Mana
$COIN Coins
You go down a nice path and find fresh veggies and a coin.
EOF
# Using read to hold.
read dd
# This is else if choice is forward then.
elif [ $aa == forward ]; then
# This cats out nothing here choice.
cat << EOF
...............................................
o -...> Theres Nothing Here.
-X-
t
$BOBS_HEALTH Mana
$COIN Coins
...............................................
Its just a empty path? Ugh Sigh...
EOF
# Using read to pause.
read ee
# This is the else it will echo a invalid chosen choice to user part of if.
else echo "Invalid choice you lose."
# Using read to pause before exit.
read bb
# The exit command due to lack of focus.
exit
# Ends the if statement.
fi
# Check for death.
if [ $BOBS_HEALTH -lt 1 ]; then
# This echos the end for you.
echo "This is the end you have died."
# A read command to pause.
read dededededed
# This will exit after death check if ded.
exit
# Move on if still alive.
else echo "still alive woot"
# This ends the if for the death check.
fi
# This calls the animation function.
animation
# This is a little trick to keep the user from accidentally pressing ''enter'' during the animation.
# This would Give blank input to the next read. Witch would be bad. So 1-3 traps should be safe.
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
# The cat command used for now what frame.
cat << EOF
$BOBS_HEALTH Mana
$COIN Coins
o Now What?
-X-
.........t........................
EOF
# This uses read to pause till press of enter.
read kk
# The cat command prints out ded fruit tree frame.
cat << EOF
@<--Fruit
o t i tt
-X- tit
t ti<-Ded Tree
...............i..............
$BOBS_HEALTH Mana
$COIN Coins
There is a ded tree with one fruit left on it do you eat it? yes or no?
EOF
# Using read to pause and ask.
read FOURTEENTH
# Then using a if then else statement to check.
if [[ $FOURTEENTH == yes ]]; then
# Adds 2 health to bob.
((BOBS_HEALTH += 2))
elif [[ $FOURTEENTH == no ]]; then
# If its no then minus 1 health from bob.
((BOBS_HEALTH -= 1))
# This will use else to echo choice does not exist.
else
# Function does not exist, handle the situation (e.g., print an error).
echo "Error: $FOURTEENTH does not exist." "do to user error the app will close with press of enter"
# Prints an error and holds user for them to read then closes with press of enter.
read error
# Another exit code.
exit
# Ends the if statement by typing if backwards or fi.
fi
# Check for death.
if [ $BOBS_HEALTH -lt 1 ]; then
echo "This is the end you have died."
read dededededed
exit
# Move on if still alive.
else echo "still alive woot"
fi
# The cat command for blah frame.
cat << EOF
o. Blah
-X- . .
......t......................
$BOBS_HEALTH Mana
$COIN Coins
It didnt look toxic? We will move on either way..
EOF
# The read command used to pause.
read mm
# Calls the animation function.
animation
# This is a little trick to keep the user from accidentally pressing ''enter'' during the animation.
# This would Give blank input to the next read. Witch would be bad. So 1-3 traps should be safe.
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
}
# This ends level four.
level4
# This begins level five.
level5(){
# Using the echo command to inform user of level five start.
echo "CONGRATSULATIONS YOU MADE IT TO LEVEL FIVE"
# The read command will wait to start lvl 5 till enter press.
read nn
# This echos begin.
echo "BEGIN LEVEL 5"
# The sleep command will pause for 1 second before calling animation function.
sleep 1
animation
# This is a little trick to keep the user from accidentally pressing ''enter'' during the animation.
# This would Give blank input to the next read. Witch would be bad. So 1-3 traps should be safe.
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
# The cat command for cabin frames.
cat << EOF
Bird --.----------.--
-vv- . AAAAAA . t t
o . A| |A . t t
-X- Cabin>. A| |A . Tree <-
......t...................A|.|A........t.......
$BOBS_HEALTH Mana
$COIN Coins
Whats this? It looks like a cabin in the woods?
EOF
# The read to pause.
read oo
# This calls the animation function.
animation
# This is a little trick to keep the user from accidentally pressing ''enter'' during the animation.
# This would Give blank input to the next read. Witch would be bad. So 1-3 traps should be safe.
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
# More use of the cat command.
cat << EOF
Bird --.----------.--
-vv- . AAAAAA . t t
o . A| |A . t t
-X- Cabin>. A| |A . Tree <-
......t...................A|.|A........t.......
$BOBS_HEALTH Mana
$COIN Coins
I swear I was just here,should I look around?yes or no?
EOF
# Using read to pause and ask.
read pp
# Going into an if conditional statement.
if [ $pp == yes ]; then
# This says if yes minus 3 health from bob.
((BOBS_HEALTH -= 3))
# It will also add 3 coins.
((COIN += 3))
# And it will cat this frame.
cat << EOF
Bird --.----------.--
-vv- . AAAAAA . t t
o Ouch I Fell . A| |A . t t
-X- Cabin>. A| |A . Tree <-
......t...................A|.|A........t.......
$BOBS_HEALTH Mana
$COIN Coins
You fell through the floor..It hurt but found 3 coins.
EOF
# And hold here till enter press.
read rr
# This says else if answer is no then.
elif [ $pp == no ]; then
# Do the animation instead.
animation
# This is a little trick to keep the user from accidentally pressing ''enter'' during the animation.
# This would Give blank input to the next read. Witch would be bad. So 1-3 traps should be safe.
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
read -t .1 -n 1 dummytrap
# Then if wrong choice it will use else to echo no not a command.
else
# Like this.
echo "Not a command you lose. Very unforgiving game.Sorry."