repl.it
@Ov3R10rd/

The Big City V1.35

HTML, CSS, JS

In this game, you are a new citizen in pixel city. You start as a humble fisherman, and move your way up to mayor. Good luck! Click Credits!

fork
loading
Files
  • index.html
index.html
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
<!DOCTYPE html>
<html>
  <head>
    <style>
      html{
        text-align:center;
        background-color:lightblue;
        border:solid black;
      }
      table,th,tr,td{
        border:solid black;
        background-color:red;
      }
      #controls{
        text-align:center;
        font-size:30px;
      }
    </style>
    <title>The Big City</title>
  </head>
  <body>
    <div id='title'>
      <h1>The Big City</h1>
      <h2>Remake of the fishing game; by Ov3r10rd</h2>
    </div>
    <br>
    <canvas id='canvas'width=500 height=500 style='border:solid black'>I am sorry, but the canvas element cannot be loaded at this time.</canvas>

    <script>
      //VARIABLES
      var canvas=document.getElementById('canvas');
      var c=canvas.getContext('2d');
      var playerX=230;
      var playerY=100;
      var playerVelocity=5;
      var backgroundId='pier';
      var equippedRod='wooden';
      var gold=0;
      var bait=10;
      var minnowCount=0;
      var tunaCount=0;
      var swordfishCount=0;
      var fishermanHired=0;
//FISH RARITIES
      var fishRarityList=['m','m','m','m','m','m','m','t','t','t'];
      //SPRITES
      function drawPierBackground(){
        //OCEAN
        c.beginPath();
        c.fillStyle='blue';
        c.fillRect(0,0,500,500);
        c.fillStyle='darkblue';
        c.fillRect(0,250,500,20);
        c.strokeStyle='lightblue';
        c.moveTo(5,321);
        c.lineTo(45,321);
        c.stroke();
        c.beginPath();
        c.strokeStyle='lightblue';
        c.moveTo(115,321);
        c.lineTo(155,321);
        c.stroke();
        c.beginPath();
        c.strokeStyle='lightblue';
        c.moveTo(335,321);
        c.lineTo(375,321);
        c.stroke();
        c.beginPath();
        c.strokeStyle='lightblue';
        c.moveTo(455,321);
        c.lineTo(495,321);
        c.stroke();
        c.strokeStyle='lightblue';
        c.moveTo(220,321);
        c.lineTo(260,321);
        c.stroke();
        //PIER
        c.beginPath();
        c.fillStyle='brown';
        c.fillRect(0,0,500,250);
        c.fillRect(10,250,30,70);
        c.fillRect(120,250,30,70);
        c.fillRect(460,250,30,70);
        c.fillRect(340,250,30,70);
        c.fillRect(225,250,30,70);

        c.fillRect(405,250,5,90);
        c.fillRect(425,250,5,90);

        c.fillRect(400,250,35,5);
        c.fillRect(400,260,35,5);
        c.fillRect(400,270,35,5);
        c.fillRect(400,280,35,5);
        c.fillRect(400,290,35,5);
        c.fillRect(400,300,35,5);
        c.fillRect(400,310,35,5);
        c.fillRect(400,320,35,5);
        c.fillRect(400,330,35,5);

        c.fillRect(340,340,100,120);
        c.fillStyle='blue';
        //c.fillRect();
        c.beginPath();
        //SHOP ENTRANCE
        c.fillStyle='tan';
        c.fillRect(150,0,175,20);
        c.fillStyle='grey';
        c.fillRect(20,100,50,10);
        c.fillRect(20,100,10,50);
        c.fillRect(20,150,50,10);
        c.fillRect(70,100,10,60);
        c.strokeStyle='black';
        c.rect(175,0,125,10);
        c.rect(150,0,175,20);
        c.stroke();
        //BORDERS
        c.strokeStyle='black';
        c.moveTo(0,250);
        c.lineTo(500,250);
        c.rect(20,100,60,60);
        c.rect(30,110,40,40);
        c.rect(340,340,100,120);
        c.rect(480,75,29,100);
        c.stroke();
        c.beginPath();
        c.fillStyle='tan';
        c.fillRect(480,75,20,100);
      };
      function drawPlayer(x,y){
        if(backgroundId!='pier'){
        }else if(backgroundId=='pier'){
          c.beginPath();
          c.fillStyle='green';
          c.fillRect(x,y,20,20);
          c.fillStyle='darkgreen';
          c.fillRect(x+5,y+5,10,10);
        }
      };
      function drawWorker(x,y){
        c.beginPath();
        c.fillStyle='tan';
        c.fillRect(x,y,40,40);
        c.fillStyle='orange';
        c.fillRect(x,y+20,40,20);
        c.fillStyle='green';
        c.fillRect(x-5,y-5,50,5);
        c.fillRect(x,y-15,40,10);
        c.fillStyle='brown';
        c.fillRect(x,y,40,10);
        c.fillRect(x+17.5,y-35,5,20);
      };
      function drawShop(){
        c.beginPath();
        c.fillStyle='tan';
        c.fillRect(0,0,500,500);
        c.fillStyle='brown';
        c.fillRect(0,300,500,200);
        c.fillRect(100,195,90,10);
        c.fillRect(300,195,90,10);
        c.fillRect(180,60,128,55);
        c.fillStyle='black';
        c.font='50px Comic Sans MS';
        c.fillText('Shop',185,100);
        c.strokeStyle='black';
        c.beginPath();
        c.font='20px Comic Sans MS';
        c.fillText('Cancel(c)',415,490);
        c.moveTo(190,0);
        c.lineTo(190,60);
        c.stroke();
        c.beginPath();
        c.moveTo(295,0);
        c.lineTo(295,60);
        c.rect(0,300,500,20);
        c.stroke();
        c.beginPath();
        c.moveTo(100,300);
        c.lineTo(100,500);
        c.stroke();
        c.beginPath();
        c.font='20px Comic Sans MS';
        c.fillText('Rods(r)',110,190);
        c.fillText('Bait(b)',310,190);
        c.fillText('Gold: '+gold,400,20);
      };
      function drawRodSection(){
        c.beginPath();
        c.fillStyle='tan';
        c.fillRect(0,0,500,500);
        c.fillStyle='brown';
        c.fillRect(0,300,500,200);

        c.moveTo(190,0);
        c.lineTo(190,60);
        c.stroke();
        c.beginPath();
        c.moveTo(295,0);
        c.lineTo(295,60);
        c.rect(0,300,500,20);
        c.stroke();
        c.beginPath();
        c.moveTo(100,300);
        c.lineTo(100,500);
        c.stroke();
        c.beginPath();
        c.fillStyle='brown';
        c.fillRect(180,60,125,55);
        c.fillStyle='black';
        c.font='20px Comic Sans MS';
        c.fillText('Rod',225,80);
        c.fillText('Upgrades',200,105);

        c.beginPath();
        c.fillStyle='black';
        c.font='20px Comic Sans MS';
        if(equippedRod=='copper'){
          c.fillText('Copper Rod(equipped)',20,150);
        }else{
          c.fillText('(1) Copper Rod $250',20,150);
        }
        if(equippedRod=='iron'){
          c.fillText('Iron Rod(equipped)',20,200);
        }else{
          c.fillText('(2) Iron Rod $500',20,200);
        }
        if(equippedRod=='gold'){
          c.fillText('Gold Rod(equipped)',20,250);
        }else{
          c.fillText('(3) Gold Rod $1,000',20,250);
        }
        c.fillText('More coming soon!',300,200);
        c.fillText('Gold: '+gold,400,20);
      };
      function drawInventory(){
        c.beginPath();
        c.fillStyle='tan';
        c.fillRect(0,0,500,500);
        c.fillStyle='brown';
        c.fillRect(0,0,250,175);
        c.fillRect(370,450,150,50);
        c.fillRect(15,220,420,85);
        c.fillRect(295,25,130,35);
        c.fillRect(40,420,170,40);
        c.fillStyle='black';
        c.font='30px Arial';
        c.fillText('Minnow(s): '+minnowCount,20,50);
        c.fillText('Tuna: '+tunaCount,20,100);
        c.fillText('Swordfish: '+swordfishCount,20,150);
        c.fillText('Current rod equipped: '+equippedRod,20,250);
        c.fillText('Gold: '+gold,20,300);
        c.fillText('Bait: '+bait,235,300);
        c.fillText('Inventory',300,50);
        c.fillText('Workers: '+fishermanHired,50,450);
        c.font='25px Arial';
        c.fillText('Cancel(c)',380,480);
        c.beginPath();
        c.moveTo(75,175);
        c.lineTo(75,220);
        c.moveTo(360,60);
        c.lineTo(360,220);
        c.moveTo(360,0);
        c.lineTo(360,25);
        c.rect(0,0,250,175);
        c.rect(370,450,150,50);
        c.rect(15,220,420,85);
        c.rect(295,25,130,35);
        c.rect(40,420,170,40);
        c.moveTo(0,440);
        c.lineTo(40,440);
        c.moveTo(130,460);
        c.lineTo(130,500);
        c.stroke();
      };
      function drawBaitSection(){
        c.beginPath();
        c.fillStyle='tan';
        c.fillRect(0,0,500,500);
        c.fillStyle='brown';
        c.fillRect(0,300,500,200);
        c.fillRect(100,195,90,10);
        c.fillRect(300,195,90,10);
        c.fillRect(195,255,110,10);
        c.fillRect(180,60,128,55);
        c.fillRect(120,120,240,30);
        c.fillStyle='black';
        c.font='50px Comic Sans MS';
        c.fillText('Bait',195,105);
        c.strokeStyle='black';
        c.beginPath();
        c.font='20px Comic Sans MS';
        c.moveTo(190,0);
        c.lineTo(190,60);
        c.stroke();
        c.beginPath();
        c.moveTo(295,0);
        c.lineTo(295,60);
        c.rect(0,300,500,20);
        c.stroke();
        c.beginPath();
        c.moveTo(100,300);
        c.lineTo(100,500);
        c.moveTo(0,135);
        c.lineTo(120,135);
        c.moveTo(360,135);
        c.lineTo(500,135);
        c.stroke();
        c.beginPath();
        c.font='20px Comic Sans MS';
        c.fillText('(1)1 bait',110,190);
        c.fillText('(2)5 bait',310,190);
        c.fillText('(3)20 bait',210,250);
        c.fillText('(4)Buy your own amount',130,140);
        c.fillText('$5',130,225);
        c.fillText('$25',330,225);
        c.fillText('$125',225,285);
        c.fillText('Gold: '+gold,400,20);
      };
      function drawFishMart(){
        c.beginPath();
        c.fillStyle='lightblue';
        c.fillRect(0,0,500,500);
        c.fillStyle='grey';
        c.fillRect(0,250,500,250);
        c.fillRect(20,20,20,230);
        c.fillRect(460,20,20,230);
        c.fillRect(10,15,480,10);
        c.strokeStyle='black';
        c.moveTo(100,225);
        c.lineTo(100,250);
        c.moveTo(130,225);
        c.lineTo(130,250);
        c.moveTo(0,250);
        c.lineTo(20,250);
        c.lineTo(20,25);
        c.lineTo(10,25);
        c.lineTo(10,15);
        c.lineTo(490,15);
        c.lineTo(490,25);
        c.lineTo(480,25);
        c.lineTo(480,250);
        c.lineTo(500,250);
        c.rect(70,170,90,55);
        c.rect(40,25,420,225);
        c.fillStyle='brown';
        c.fillRect(70,170,90,55);
        c.fillStyle='black';
        c.font='20px Comic Sans MS';
        c.fillText('Sell your',75,190);
        c.fillText('fish!',95,215);
        c.fillText('Cancel(c)',400,490);
        if(minnowCount==0&&tunaCount==0&&swordfishCount==0){
          c.fillText('Sorry, you have no fish to sell.',110,350);
        }else{
          c.font='15px Comic Sans MS';
          c.fillText('(1) Sell all '+minnowCount+' minnow(s), '+tunaCount+' tuna and '+swordfishCount+' swordfish for '+findFishValue(minnowCount,tunaCount,swordfishCount)+' gold?',30,350);
        }
        c.stroke();
      };
      function drawFishingArea(){
        c.beginPath();
        c.fillStyle='lightBlue';
        c.fillRect(0,0,500,500);
        c.fillStyle='brown';
        c.fillRect(300,275,200,30);
        c.fillRect(310,305,20,50);
        c.fillRect(400,305,20,50);
        c.fillStyle='yellow';
        c.fillRect(100,50,100,100);
        c.fillStyle='blue';
        c.fillRect(0,350,500,150);

        c.moveTo(500,275);
        c.lineTo(300,275);
        c.lineTo(300,305);
        c.lineTo(310,305);
        c.lineTo(310,350);
        c.moveTo(330,350);
        c.lineTo(330,305);
        c.lineTo(400,305);
        c.lineTo(400,350);
        c.moveTo(420,350);
        c.lineTo(420,305);
        c.lineTo(500,305);
        c.moveTo(0,350);
        c.lineTo(500,350);
        c.moveTo(425,275);
        c.lineTo(425,305);
        c.rect(100,50,100,100);
        c.stroke();
        
        c.fillStyle='grey';
        c.fillRect(300,270,15,5);
        c.fillRect(305,265,5,5);
        c.beginPath();
        if(equippedRod=='wooden'){
          c.fillStyle='brown';
        }else if(equippedRod=='copper'){
          c.fillStyle='red'
        }else if(equippedRod=='iron'){
          c.fillStyle='darkgrey';
        }else if(equippedRod=='gold'){
          c.fillStyle='gold';
        }
        c.fillRect(305,255,5,10);
        c.fillRect(300,240,5,15);
        c.fillRect(298,230,5,10);
        c.fillRect(296,225,5,5);
        c.fillRect(288,220,10,5);
        c.fillRect(268,215,25,5);
        c.fillRect(263,220,10,5);
        c.fillRect(258,223,5,15);
        c.fillStyle='white';
        c.fillRect(260,238,1,120);
        c.fillStyle='red';
        c.fillRect(258,358,5,5);
        c.fillStyle='white';
        c.fillRect(258,360.2,5,1);
        c.fillStyle='grey';
        c.fillRect(300,250,10,10);
        
        
        c.beginPath();
        c.fillStyle='white';
        c.fillRect(330,70,80,50);
        c.fillRect(50,230,120,40);
        c.fillStyle='black';
        c.font='30px Comic Sans MS';
        c.fillText('Cancel(c)',370,490);
        c.font='20px Comic Sans MS';
        c.fillText('(1)Fish',340,100);
        c.fillText('Bait: '+bait,55,260);
        if(fishermanHired!=0){
          var wx=330;
          var wy=235;
          for(var a=0;a<fishermanHired;a++){
            drawWorker(wx,wy);
            wx+=55;
          }
        }else{}
      };
      function drawEndScreen(){
        c.beginPath();
        c.fillRect(0,0,500,500);
        c.font='50px Arial';
        c.fillStyle='white';
        c.fillText('Thanks for playing!',40,100);
        c.font='30px Arial';
        c.fillText('Press 1 to start again!',100,300);
      };
      function drawWorkPlace(){
        c.beginPath();
        c.fillStyle='tan';
        c.fillRect(0,0,500,500);
        c.fillStyle='brown';
        c.fillRect(0,250,500,250);

        c.fillRect(150,50,200,50);
        c.fillRect(145,165,210,40);

        c.beginPath();
        c.fillStyle='black';
        c.font='20px Comic Sans MS';
        c.fillText('Fisherman for hire!',160,75);
        c.fillText('Cancel(c)',410,490);
        c.fillText('(1)Hire a Fisherman!',155,190);
        c.fillText('$2500',220,160);
        c.strokeStyle='black';
        c.moveTo(0,250);
        c.lineTo(500,250);
        c.moveTo(185,0);
        c.lineTo(185,50);
        c.moveTo(310,0);
        c.lineTo(310,50);
        c.moveTo(0,185);
        c.lineTo(145,185);
        c.moveTo(355,185);
        c.lineTo(500,185);
        c.stroke();
      };
      //GAME FUNCTIONS_______________________________>
      function drawBackground(id){
        if(id=='pier'){
          drawPierBackground();
        }else if(id=='shop'){
          drawShop();
        }else if(id=='rods'){
          drawRodSection();
        }else if(id=='bait'){
          drawBaitSection();
        }else if(id=='inventory'){
          drawInventory();
        }else if(id=='fishMart'){
          drawFishMart();
        }else if(id=='fishing'){
          drawFishingArea();
        }else if(id=='endGame'){
          drawEndScreen();
        }else if(id=='workPlace'){
          drawWorkPlace();
        }
      };
      function fishRarity(equippedRod){
        if(equippedRod=='copper'){
          fishRarityList=['m','m','m','m','m','m','t','t','t','s'];
        }else if(equippedRod=='iron'){
          fishRarityList=['m','m','m','m','m','t','t','t','s','s'];
        }else if(equippedRod=='gold'){
          fishRarityList=['m','m','m','t','t','t','t','s','s','s'];
        }
      };
      function fish(){
        var randomNum=Math.floor(Math.random()*10);
        var fishResult=fishRarityList[randomNum];
        if(fishResult=='m'){
          minnowCount+=1;
          alert('You caught a minnow!');
        }else if(fishResult=='t'){
          tunaCount+=1;
          alert('You caught a tuna!');
        }else if(fishResult=='s'){
          swordfishCount+=1;
          alert('You caught a swordfish!');
        }
      };
      function enterShop(px,py){
        if(150<px+20&&150+175>px&&0<py+20&&0+20>py){
          backgroundId='shop';
        }
      };
      function enterFishMart(px,py){
        if(20<px+20&&20+60>px&&100<py+20&&100+60>py){
          backgroundId='fishMart';
        }
      };
      function enterFishingPlank(px,py){
        if(px<400+35&&px+20>400&&py<225+25&&py+20>225){
          backgroundId='fishing';
        }
      };
      function enterWorkPlace(px,py){
        if(480<px+20&&480+20>px&&75<py+20&&75+100>py){
          backgroundId='workPlace';
        }
      };
      function findFishValue(minnowCount,tunaCount,swordfishCount){
        var minnowValue=minnowCount*5;
        var tunaValue=tunaCount*20;
        var swordfishValue=swordfishCount*60;
        var fishValue=minnowValue+tunaValue+swordfishValue;
        return fishValue;
      };
      function creditOne(){
        alert("Original idea/game by: AmeliaBlackwell");
        alert("Remake by: Ov3r10rd");
        alert("Have fun! And check out Amelia's account! :P");
      };
      function creditTwo(){
        alert("Original idea/game by: AmeliaBlackwell");
        alert("Remake by: Ov3r10rd");
        alert('Keep playing! And have fun!');
      };
      function goToPier(){
        playerX=230;
        playerY=50;
        backgroundId='pier';
        drawBackground(backgroundId);
        drawPlayer(playerX,playerY);
      };
      function goToPier2(){
        playerX=400;
        playerY=200;
        backgroundId='pier';
        drawBackground(backgroundId);
        drawPlayer(playerX,playerY);
      };
      function goToPier3(){
        playerX=450;
        playerY=115;
        backgroundId='pier';
        drawBackground(backgroundId);
        drawPlayer(playerX,playerY);
      };
      function goToShop(){
        backgroundId='shop';
        drawBackground(backgroundId);
      };
      function rodSelection(){
        return prompt('What would you like to buy?(4 to exit)');
      };
      function baitSelection(){
        return prompt('What would you like to buy?(5 to exit)');
      };
      function howMuchQuestion(){
        return prompt('How much bait would you like to buy?');
      };
      function howMuch(){
        var choice4=howMuchQuestion();
        var total=choice4*5;
        var yesNo=prompt('Buy '+choice4+' bait for '+total+' gold? y/n');
        if(yesNo=='y'&&gold>=total){
          bait+=choice4;
          gold-=total;
          goToShop();
          alert('Done!');
        }else if(yesNo=='y'&&gold<total){
          goToShop();
          alert('You do not have enough gold!');
        }else if(yesNo=='n'){
          goToShop();
        }else{}
      };
      function rodChoice(){
        var choice1=rodSelection();
        if(choice1=='1'){
          if(gold>=250&&equippedRod!='copper'){
            equippedRod='copper';
            gold-=250
            goToPier();
            alert('Copper rod purchased!');
          }else if(gold<250){
            goToShop();
            alert('You do not have enough gold for this item!');
          }else if(equippedRod=='copper'){
            goToShop();
            alert('You already have this item!');
          }
        }else if(choice1=='2'){
          if(gold>=500&&equippedRod!='iron'){
            equippedRod='iron';
            gold-=500;
            goToPier();
            alert('Iron rod purchased!');
          }else if(gold<500){
            goToShop();
            alert('You do not have enough gold for this item!');
          }else if(equippedRod=='iron'){
            goToShop();
            alert('You already have this item!');
          }
        }else if(choice1=='3'){
          if(gold>=1000&&equippedRod!='gold'){
            equippedRod='gold';
            gold-=1000;
            goToPier();
            alert('Gold rod purchased!');
          }else if(gold<1000){
            goToShop();
            alert('You do not have enough gold for this item!');
          }else if(equippedRod=='gold'){
            goToShop();
            alert('You already have this item!');
          }
        }else if(choice1=='4'){
          goToShop();
        }else{
          goToShop();
          alert('Sorry, that is currently not in stock! If you have an idea, be sure to share it with me in the comments!');
        }
      };
      function workersFish(){
        for(var b=0;b<fishermanHired;b++){
          var randomNum2=Math.floor(Math.random()*10);
          var workersCatch=fishRarityList[randomNum2];
          if(workersCatch=='m'){
            minnowCount+=1;
          }else if(workersCatch=='t'){
            tunaCount+=1;
          }else if(workersCatch=='s'){
            swordfishCount+=1;
          }
        }
      };
      function baitChoice(){
        var choice2=baitSelection();
        if(choice2=='1'){
          if(gold>=5){
            gold-=5;
            bait+=1;
            goToShop();
            alert('One bait purchased!');
          }else if(gold<5){
            goToShop();
            alert('You do not have enough gold for this item!');
          }
        }else if(choice2=='2'){
          if(gold>=25){
            gold-=25;
            bait+=5;
            goToShop();
            alert('Bait 5 pack purchased!');
          }else if(gold<25){
            goToShop();
            alert('You do not have enough gold for this item!');
          }
        }else if(choice2=='3'){
          if(gold>=125){
            gold-=125;
            bait+=20;
            goToShop();
            alert('Bait 25 pack purchased!');
          }else if(gold<125){
            goToShop();
            alert('You do not have enough gold for this item!');
          }
        }else if(choice2=='4'){
          howMuch();
        }else if(choice2=='5'){
          goToShop();
        }else{
          goToShop();
          alert('Sorry, that is currently not in stock! If you have an idea, be sure to share it with me in the comments!');
        }
      };
      function lose(){
        if(gold==0&&bait==0&&minnowCount==0&&tunaCount==0&&swordfishCount==0){
          alert('Sorry, but you have run out of money, bait and fish. GG!');
          backgroundId='endGame';
          drawBackground(backgroundId);
          setTimeout(creditTwo,1);
        }
      };
//FUNCTION CALL
      function call(){
        //GAME FUNCTIONS(any order is fine)
        enterShop(playerX,playerY);
        enterFishMart(playerX,playerY);
        enterFishingPlank(playerX,playerY);
        enterWorkPlace(playerX,playerY);
        fishRarity(equippedRod);
        lose();
        //SPRITES(in order)
        drawBackground(backgroundId);
        drawPlayer(playerX,playerY);
      };
      call();
      //MOVE
      function move(event){
        call();
        if(event.keyCode==68&&playerX+20<500){
          playerX+=playerVelocity;
        }else if(event.keyCode==65&&playerX>0){
          playerX-=playerVelocity;
       }else if(event.keyCode==83&&playerY+20<250){
          playerY+=playerVelocity;
        }else if(event.keyCode==87&&playerY>0){
            playerY-=playerVelocity;
//WORKPLACE HOMEPAGE
        }else if(event.keyCode==67&&backgroundId=='workPlace'){
          goToPier3();
        }else if(event.keyCode==49&&backgroundId=='workPlace'){
          if(gold>=2500&&fishermanHired<4){
            fishermanHired+=1;
             gold-=2500;
            goToPier3();
            alert('1 fisherman hired! They will now fish with you!');
          }else if(gold<2500){
             goToPier3();
            alert('You cannot hire this worker without pay!');
          }else if(fishermanHired==3){
            goToPier3();
            alert('You cannot hire more than 3 workers!');
          }
//RESTART GAME
        }else if(event.keyCode==49&&backgroundId=='endGame'){
          document.location.reload();
  //FISHING HOMEPAGE
        }else if(event.keyCode==49&&backgroundId=='fishing'&&bait>0){
          bait-=1;
          fish();
          workersFish();
          drawBackground(backgroundId);
//INVENTORY HOMEPAGE
        }else if(event.keyCode==73&&backgroundId=='pier'){
           backgroundId='inventory';
           drawBackground(backgroundId);
        }else if(event.keyCode==67&&backgroundId=='inventory'){
          backgroundId='pier';
          drawBackground(backgroundId);
          drawPlayer(playerX,playerY);
//SHOP HOMEPAGE
        }else if(event.keyCode==67&&backgroundId=='shop'){
          goToPier();
        }else if(event.keyCode==67&&backgroundId=='fishing'){
          goToPier2();
//RODS HOMEPAGES
        }else if(event.keyCode==82&&backgroundId=='shop'){
          backgroundId='rods';
          drawBackground(backgroundId);
          setTimeout(rodChoice,500);
//BAIT HOMEPAGE
        }else if(event.keyCode==66&&backgroundId=='shop'){
          backgroundId='bait';
          drawBackground(backgroundId);
          setTimeout(baitChoice,500);
//FISHMART HOMEPAGE
        }else if(event.keyCode==67&&backgroundId=='fishMart'){
          playerX=100;
          playerY=120;
          backgroundId='pier';
          drawBackground(backgroundId);
          drawPlayer(playerX,playerY);
        }else if(event.keyCode==49&&backgroundId=='fishMart'){
          gold+=findFishValue(minnowCount,tunaCount,swordfishCount);
          minnowCount=0;
          tunaCount=0;
          swordfishCount=0;
          playerX=100;
          playerY=120;
          backgroundId='pier';
          drawBackground(backgroundId);
          drawPlayer(playerX,playerY);
         alert('Your fish was successfully sold!');
        }
      };
      document.onkeydown=move;
    </script>
    <div id='credits'>
      <button onclick="setTimeout(creditOne,1);">Credits</button>
    </div>
    <div id='controls'>
      <h3>Controls</h3>
      <table align='center'>
        <tr>
          <th>Open inventory:</th>
          <td>i</td>
        </tr>
        <tr>
          <th>Move up:</th>
          <td>w</td>
        </tr>
        <tr>
          <th>Move down:</th>
          <td>s</td>
        </tr>
        <tr>
          <th>Move right:</th>
          <td>d</td>
        </tr>
        <tr>
          <th>Move left:</th>
          <td>a</td>
        </tr>
      </table>
    </div>
  </body>
</html>
result
console