This repository has been archived by the owner on Nov 27, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBomberman_Nuclear_Edition.pde
executable file
·1032 lines (971 loc) · 24.2 KB
/
Bomberman_Nuclear_Edition.pde
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
PFont font, bombFont, timeFont, exitFont;
//X co-ordinates of all the boxes
int B1X = 130;
int B2X = 230;
int B3X = 130;
int B4X = 430;
int B5X= 530;
int B6X = 330;
int B7X = 230;
int B8X = 430;
int B9X = 30;
int B10X = 430;
//Y co-ordiantes of all the boxes
int B1Y = 30;
int B2Y = 130;
int B3Y = 330;
int B4Y = 430;
int B5Y = 130;
int B6Y = 230;
int B7Y = 530;
int B8Y = 330;
int B9Y = 430;
int B10Y = 30;
//fill for box 1
int r1 = 25;
int g1 = 125;
int b1 = 255;
int a1 = 75;
//fill for box 2
int r2 = 25;
int g2 = 125;
int b2 = 255;
int a2 = 75;
//fill for box 3
int r3 = 25;
int g3 = 125;
int b3 = 255;
int a3 = 75;
//fill for box 4
int r4 = 25;
int g4 = 125;
int b4 = 255;
int a4 = 75;
//fill for box 5
int r5 = 25;
int g5 = 125;
int b5 = 255;
int a5 = 75;
//fill for box 6
int r6 = 25;
int g6 = 125;
int b6 = 255;
int a6 = 75;
//fill for box 7
int r7 = 25;
int g7 = 125;
int b7 = 255;
int a7 = 75;
//fill for box 8
int r8 = 25;
int g8 = 125;
int b8 = 255;
int a8 = 75;
//fill for box 9
int r9 = 25;
int g9= 125;
int b9 = 255;
int a9 = 75;
//fill for box 10
int r10 = 25;
int g10 = 125;
int b10 = 255;
int a10 = 75;
int Cry = 600;
int bombs = 10;
int parts = 0;
int boxCount = 10;
float startTime, currentTime;
float blownTime;
man[] a;
bomb[] b;
PImage guyw;
PImage guya;
PImage guys;
PImage guyd;
//PImage guy;
PImage title;
PImage credits;
PImage story;
PImage bomb;
PImage bombXplod;
PImage charge1;
PImage charge2;
PImage charge3;
PImage charge4;
PImage charge5;
PImage charge6;
PImage charge7;
PImage charge8;
PImage charge9;
PImage charge10;
PImage nuke;
int scr = 1;
color C1 = color (136,21,21);
boolean wPressed, aPressed, sPressed, dPressed, bPressed, bReleased;
boolean bombTime = false;
boolean counting = false;
boolean blownUp = false;
boolean minusBomb = false;
boolean bombsRemain = true;
boolean charge1Visible = false;
boolean charge2Visible = false;
boolean charge3Visible = false;
boolean charge4Visible = false;
boolean charge5Visible = false;
boolean charge6Visible = false;
boolean charge7Visible = false;
boolean charge8Visible = false;
boolean charge9Visible = false;
boolean charge10Visible = false;
boolean isItWorking = true;
void setup()
{
frameRate (15);
size (800, 600);
background (C1);
noStroke();
font = loadFont("Verdana-36.vlw");
bombFont = loadFont("Dialog-20.vlw");
timeFont = loadFont("ACaslonPro-Italic-14.vlw");
exitFont = loadFont("Algerian-22.vlw");
title = loadImage("Title.jpg");
credits = loadImage("Credits.jpg");
story = loadImage("Story.png");
//guy = loadImage("guy.gif");
guyw = loadImage("guyw.PNG");
guya = loadImage("guya.PNG");
guys = loadImage("guys.PNG");
guyd = loadImage("guyd.PNG");
bomb = loadImage("bomb.png");
bombXplod = loadImage("bombXplod.png");
charge1 = loadImage("charge.png");
charge2 = loadImage("charge.png");
charge3 = loadImage("charge.png");
charge4 = loadImage("charge.png");
charge5 = loadImage("charge.png");
charge6 = loadImage("charge.png");
charge7 = loadImage("charge.png");
charge8 = loadImage("charge.png");
charge9 = loadImage("charge.png");
charge10 = loadImage("charge.png");
nuke = loadImage("bigBomb.png");
a = new man [1];
a[0] = new man();
a[0].manX = 525;
a[0].manY = 525;
a[0].wallX = 75;
a[0].wallY = 75;
a[0].wallsize = 50;
b = new bomb[9];
for(int i = 0; i < b.length; i++)
{
b[i] = new bomb();
}
}
void draw()
{
field();
if(bombs == 0)
{
bombsRemain = false;
if(a[0].manX == 25 && a[0].manY == 25)
{
scr = 4;
}
}
if(scr == 1)
{
image(title, 25, 200);
}
if(mousePressed && scr == 1)
{
scr = 2;
}
else if(mousePressed && scr == 2)
{
scr = 3;
}
/**
*
*/
if(scr == 2)
{
image(story, 50, 100);
}
if(scr == 3)
{
score();
if(parts > 10)
{
parts -= 1;
}
fill(25, 255, 150, 500);
textFont(exitFont);
text("EXIT", 26, 55);
fill(25, 255, 150, 25);
rect(25, 25, 50, 50);
fill(r1, g1, b1, a1);
rect(B1X, B1Y, 40, 40); //box one at 130, 30
fill(r2, g2, b2, a2);
rect(B2X, B2Y, 40, 40); //box two at 230, 130
fill(r3, g3, b3, a3);
rect(B3X, B3Y, 40, 40); //box three at 130, 330
fill(r4, g4, b4, a4);
rect(B4X, B4Y, 40, 40); //box four at 430, 430
fill(r5, g5, b5, a5);
rect(B5X, B5Y, 40, 40); //box five at 530, 130
fill(r6, g6, b6, a6);
rect(B6X, B6Y, 40, 40); //box six at 330, 230
fill(r7, g7, b7, a7);
rect(B7X, B7Y, 40, 40); //box seven at 230, 530
fill(r8, g8, b8, a8);
rect(B8X, B8Y, 40, 40); //box eight at 430, 330
fill(r9, g9, b9, a9);
rect(B9X, B9Y, 40, 40); //box nine at 30, 430
fill(r10, g10, b10, a10);
rect(B10X, B10Y, 40, 40); //box ten at 430, 30
a[0].wall();
a[0].show();
a[0].move();
if(bPressed == true)//bomb activate
{
for(int i = 0; i < b.length; i++)
{
b[i].x = a[0].manX;
b[i].y = a[0].manY;
}
}
if(bombTime)
{
counting = true;
startTime = millis();
}
//Kill!!!!!!!!!!!!
if(bReleased == true)
{
for(int i = 0; i < b.length; i++)
{
b[i].show();
}
if(counting)
{
currentTime = millis();
blownTime = (float)((currentTime-startTime)/1000);
//text(blownTime, 600, 250);
}
bombTime = false;
blownUp = false;
}
if(blownTime > 2)
{
if(blownUp)
{
for(int i = 0; i < b.length; i++)
{
//Box distance test At
float blowAt1 = dist(b[i].x, b[i].y, B1X, B1Y);
float blowAt2 = dist(b[i].x, b[i].y, B2X, B2Y);
float blowAt3 = dist(b[i].x, b[i].y, B3X, B3Y);
float blowAt4 = dist(b[i].x, b[i].y, B4X, B4Y);
float blowAt5 = dist(b[i].x, b[i].y, B5X, B5Y);
float blowAt6 = dist(b[i].x, b[i].y, B6X, B6Y);
float blowAt7 = dist(b[i].x, b[i].y, B7X, B7Y);
float blowAt8 = dist(b[i].x, b[i].y, B8X, B8Y);
float blowAt9 = dist(b[i].x, b[i].y, B9X, B9Y);
float blowAt10 = dist(b[i].x, b[i].y, B10X, B10Y);
//Box distance test Right
float blowRight1 = dist(b[i].x +50, b[i].y, B1X, B1Y);
float blowRight2 = dist(b[i].x +50, b[i].y, B2X, B2Y);
float blowRight3 = dist(b[i].x +50, b[i].y, B3X, B3Y);
float blowRight4 = dist(b[i].x +50, b[i].y, B4X, B4Y);
float blowRight5 = dist(b[i].x +50, b[i].y, B5X, B5Y);
float blowRight6 = dist(b[i].x +50, b[i].y, B6X, B6Y);
float blowRight7 = dist(b[i].x +50, b[i].y, B7X, B7Y);
float blowRight8 = dist(b[i].x +50, b[i].y, B8X, B8Y);
float blowRight9 = dist(b[i].x +50, b[i].y, B9X, B9Y);
float blowRight10 = dist(b[i].x +50, b[i].y, B10X, B10Y);
//Box distance test Left
float blowLeft1 = dist(b[i].x -50, b[i].y, B1X, B1Y);
float blowLeft2 = dist(b[i].x -50, b[i].y, B2X, B2Y);
float blowLeft3 = dist(b[i].x -50, b[i].y, B3X, B3Y);
float blowLeft4 = dist(b[i].x -50, b[i].y, B4X, B4Y);
float blowLeft5 = dist(b[i].x -50, b[i].y, B5X, B5Y);
float blowLeft6 = dist(b[i].x -50, b[i].y, B6X, B6Y);
float blowLeft7 = dist(b[i].x -50, b[i].y, B7X, B7Y);
float blowLeft8 = dist(b[i].x -50, b[i].y, B8X, B8Y);
float blowLeft9 = dist(b[i].x -50, b[i].y, B9X, B9Y);
float blowLeft10 = dist(b[i].x -50, b[i].y, B10X, B10Y);
//Box distance test Up
float blowUp1 = dist(b[i].x , b[i].y -50, B1X, B1Y);
float blowUp2 = dist(b[i].x , b[i].y -50, B2X, B2Y);
float blowUp3 = dist(b[i].x , b[i].y -50, B3X, B3Y);
float blowUp4 = dist(b[i].x , b[i].y -50, B4X, B4Y);
float blowUp5 = dist(b[i].x , b[i].y -50, B5X, B5Y);
float blowUp6 = dist(b[i].x , b[i].y -50, B6X, B6Y);
float blowUp7 = dist(b[i].x , b[i].y -50, B7X, B7Y);
float blowUp8 = dist(b[i].x , b[i].y -50, B8X, B8Y);
float blowUp9 = dist(b[i].x , b[i].y -50, B9X, B9Y);
float blowUp10 = dist(b[i].x , b[i].y -50, B10X, B10Y);
//Box distance test Down
float blowDown1 = dist(b[i].x , b[i].y -50, B1X, B1Y);
float blowDown2 = dist(b[i].x , b[i].y -50, B2X, B2Y);
float blowDown3 = dist(b[i].x , b[i].y -50, B3X, B3Y);
float blowDown4 = dist(b[i].x , b[i].y -50, B4X, B4Y);
float blowDown5 = dist(b[i].x , b[i].y -50, B5X, B5Y);
float blowDown6 = dist(b[i].x , b[i].y -50, B6X, B6Y);
float blowDown7 = dist(b[i].x , b[i].y -50, B7X, B7Y);
float blowDown8 = dist(b[i].x , b[i].y -50, B8X, B8Y);
float blowDown9 = dist(b[i].x , b[i].y -50, B9X, B9Y);
float blowDown10 = dist(b[i].x , b[i].y -50, B10X, B10Y);
if ((blowAt1 == 0) ||
(blowRight1 < 50) ||
(blowLeft1 < 50) ||
(blowUp1 < 50) ||
(blowDown1 < 50))
{
r1 = 136;
g1 = 21;
b1 = 21;
a1 = 0;
image(charge1, B1X-5, B1Y-5);
charge1Visible = true;
} else
if ((blowAt2 == 0) ||
(blowRight2 < 50) ||
(blowLeft2 < 50) ||
(blowUp2 < 50) ||
(blowDown2 < 50))
{
r2 = 136;
g2 = 21;
b2 = 21;
a2 = 0;
image(charge2, B2X-5, B2Y-5);
charge2Visible = true;
} else
if ((blowAt3 == 0) ||
(blowRight3 < 50) ||
(blowLeft3 < 50) ||
(blowUp3 < 50) ||
(blowDown3 < 50))
{
r3 = 136;
g3 = 21;
b3 = 21;
a3 = 0;
image(charge3, B3X-5, B3Y-5);
charge3Visible = true;
} else
if ((blowAt4 == 0) ||
(blowRight4 < 50) ||
(blowLeft4 < 50) ||
(blowUp4 < 50) ||
(blowDown4 < 50))
{
r4 = 136;
g4 = 21;
b4 = 21;
a4 = 0;
image(charge4, B4X-5, B4Y-5);
charge4Visible = true;
} else
if ((blowAt5 == 0) ||
(blowRight5 < 50) ||
(blowLeft5 < 50) ||
(blowUp5 < 50) ||
(blowDown5 < 50))
{
r5 = 136;
g5 = 21;
b5 = 21;
a5 = 0;
image(charge5, B5X-5, B5Y-5);
charge5Visible = true;
} else
if ((blowAt6 == 0) ||
(blowRight6 < 50) ||
(blowLeft6 < 50) ||
(blowUp6 < 50) ||
(blowDown6 < 50))
{
r6 = 136;
g6 = 21;
b6 = 21;
a6 = 0;
image(charge6, B6X-5, B6Y-5);
charge6Visible = true;
} else
if ((blowAt7 == 0) ||
(blowRight7 < 50) ||
(blowLeft7 < 50) ||
(blowUp7 < 50) ||
(blowDown7 < 50))
{
r7 = 136;
g7 = 21;
b7 = 21;
a7 = 0;
image(charge7, B7X-5, B7Y-5);
charge7Visible = true;
} else
if ((blowAt8 == 0) ||
(blowRight8 < 50) ||
(blowLeft8 < 50) ||
(blowUp8 < 50) ||
(blowDown8 < 50))
{
r8 = 136;
g8 = 21;
b8 = 21;
a8 = 0;
image(charge8, B8X-5, B8Y-5);
charge8Visible = true;
} else
if ((blowAt9 == 0) ||
(blowRight9 < 50) ||
(blowLeft9 < 50) ||
(blowUp9 < 50) ||
(blowDown9 < 50))
{
r9 = 136;
g9 = 21;
b9 = 21;
a9 = 0;
image(charge9, B9X-5, B9Y-5);
charge9Visible = true;
} else
if ((blowAt10 == 0) ||
(blowRight10 < 50) ||
(blowLeft10 < 50) ||
(blowUp10 < 50) ||
(blowDown10 < 50))
{
r10 = 136;
g10 = 21;
b10 = 21;
a10 = 0;
image(charge10, B10X-5, B10Y-5);
charge10Visible = true;
}
}
if(charge1Visible)
{
if(a[0].manX == B1X-5 && a[0].manY == B1Y-5)
{
parts += 1;
charge1Visible = false;
}
} else
if(charge2Visible)
{
if(a[0].manX == B1X-5 && a[0].manY == B1Y-5)
{
parts += 1;
charge2Visible = false;
}
} else
if(charge3Visible)
{
if(a[0].manX == B1X-5 && a[0].manY == B1Y-5)
{
parts += 1;
charge3Visible = false;
}
} else
if(charge4Visible)
{
if(a[0].manX == B1X-5 && a[0].manY == B1Y-5)
{
parts += 1;
charge4Visible = false;
}
} else
if(charge5Visible)
{
if(a[0].manX == B1X-5 && a[0].manY == B1Y-5)
{
parts += 1;
charge5Visible = false;
}
} else
if(charge6Visible)
{
if(a[0].manX == B1X-5 && a[0].manY == B1Y-5)
{
parts += 1;
charge6Visible = false;
}
} else
if(charge7Visible)
{
if(a[0].manX == B1X-5 && a[0].manY == B1Y-5)
{
parts += 1;
charge7Visible = false;
}
} else
if(charge8Visible)
{
if(a[0].manX == B1X-5 && a[0].manY == B1Y-5)
{
parts += 1;
charge8Visible = false;
}
} else
if(charge9Visible)
{
if(a[0].manX == B1X-5 && a[0].manY == B1Y-5)
{
parts += 1;
charge9Visible = false;
}
} else
if(charge10Visible)
{
if(a[0].manX == B1X-5 && a[0].manY == B1Y-5)
{
parts += 1;
charge10Visible = false;
}
}
}
else
{
for(int i = 0; i < b.length; i++)
{
image(bombXplod, b[i].x, b[i].y);
fill(150,0,0);
//Kill Guy
float killat = dist(b[i].x, b[i].y, a[0].manX, a[0].manY);
float killright = dist(b[i].x +50, b[i].y, a[0].manX, a[0].manY);
float killleft = dist(b[i].x -50, b[i].y, a[0].manX, a[0].manY);
float killup = dist(b[i].x , b[i].y -50, a[0].manX, a[0].manY);
float killdown = dist(b[i].x , b[i].y +50, a[0].manX, a[0].manY);
if ((killat == 0) ||
(killright < 50) ||
(killleft < 50) ||
(killup < 50) ||
(killdown < 50))
{
scr = 5;
}
}
bReleased = false;
blownUp = true;
minusBomb = true;
}
if(minusBomb)
{
bombs -= 1;
minusBomb = false;
}
}
}
if(scr == 4)
{
field();
score();
image(nuke, 135, 100);
}
if(scr == 5)
{
textFont(font);
text("You Died!", 200, 300);
image(credits, 25, Cry);
Cry = Cry - 5;
}
if(scr == 6)
{
image(credits, 25, Cry);
text("SUCCESS!!! You Win!", 200, 300);
Cry = Cry - 5;
}
textFont(timeFont);
int s = second(); // Values from 0 - 59
int m = minute(); // Values from 0 - 59
int h = hour(); // Values from 0 - 23
fill(0);
text("The time is-"+h+":"+m+":"+s, 625, 570);
}
void keyPressed()
{
if (key == 'b' && bombsRemain == true)
{
bPressed = true;
status("BOMB!!! Run!");
}
if (key == 'w')
{
wPressed = true;
bombTime = false;
status("up");
}
if (key == 'a')
{
aPressed = true;
bombTime = false;
status("left");
}
if (key == 's')
{
sPressed = true;
bombTime = false;
status("down");
}
if (key == 'd')
{
dPressed = true;
bombTime = false;
status("right");
}
}
void keyReleased()
{
if (key == 'b' && bombsRemain == true) bReleased = true;
if (key == 'b' && bombsRemain == true) bombTime = true;
if (key == 'b') bPressed = false;
if (key == 'w') wPressed = false;
if (key == 'a') aPressed = false;
if (key == 's') sPressed = false;
if (key == 'd') dPressed = false;
}
void field()
{
//bg
//background (C1);
fill (100);
rect (25,25,550,550);
rect (600,25,175,550);
}
void score()
{
fill(0);
textFont(font);
float now = millis();
int sec = (int)(now/1000);
text("Time:"+sec, 600, 75);
//bombs
textFont(bombFont);
text("Bombs:"+bombs, 600, 150);
//parts
text("Charges:"+parts+"/10", 600, 175);
}
class bomb
{
float x, y;
void show()
{
for(int i = 0; i < b.length; i++)
{
image(bomb, b[i].x, b[i].y);
}
}
}
class man
{
float manX, manY, mansize, wallX, wallY, wallsize;
int imagecount;
void wall()
{
for(wallX = 75; wallX < 550; wallX += 100)
{
for(wallY = 75 ; wallY < 550; wallY += 100)
{
fill (C1);
rect (wallX,wallY, wallsize,wallsize);
}
}
}
void show ()
{
fill(100);
rect (manX,manY,50,50);
image (guyw,manX,manY);
if (imagecount == 1)
{
rect (manX,manY,50,50);
image(guyw,manX,manY);
}
else if (imagecount == 2)
{
rect (manX,manY,50,50);
image(guys,manX,manY);
}
else if (imagecount == 3)
{
rect (manX,manY,50,50);
image(guya,manX,manY);
}
else if (imagecount == 4)
{
rect (manX,manY,50,50);
image(guyd,manX,manY);
}
}
void move ()
{
if (wPressed)
{
manY-=50;
imagecount = 1;
}
if (sPressed)
{
manY+=50;
imagecount =2;
}
if (aPressed)
{
manX-=50;
imagecount = 3;
}
if (dPressed)
{
manX+=50;
imagecount = 4;
}
// -----BLOCK FOR FIRST ROW-----
if(wPressed)
{
if((manX == 75 && manY == 75) ||
(manX == 175 && manY == 75) ||
(manX == 275 && manY == 75) ||
(manX == 375 && manY == 75) ||
(manX == 475 && manY == 75))
{
manY += 50;
}
}
if(aPressed)
{
if((manX == 75 && manY == 75) ||
(manX == 175 && manY == 75) ||
(manX == 275 && manY == 75) ||
(manX == 375 && manY == 75) ||
(manX == 475 && manY == 75))
{
manX += 50;
}
}
if(sPressed)
{
if((manX == 75 && manY == 75) ||
(manX == 175 && manY == 75) ||
(manX == 275 && manY == 75) ||
(manX == 375 && manY == 75) ||
(manX == 475 && manY == 75))
{
manY -= 50;
}
}
if(dPressed)
{
if((manX == 75 && manY == 75) ||
(manX == 175 && manY == 75) ||
(manX == 275 && manY == 75) ||
(manX == 375 && manY == 75) ||
(manX == 475 && manY == 75))
{
manX -= 50;
}
}
//-----BLOCK FOR SECOND ROW-----
if(wPressed)
{
if((manX == 75 && manY == 175) ||
(manX == 175 && manY == 175) ||
(manX == 275 && manY == 175) ||
(manX == 375 && manY == 175) ||
(manX == 475 && manY == 175))
{
manY += 50;
}
}
if(aPressed)
{
if((manX == 75 && manY == 175) ||
(manX == 175 && manY == 175) ||
(manX == 275 && manY == 175) ||
(manX == 375 && manY == 175) ||
(manX == 475 && manY == 175))
{
manX += 50;
}
}
if(sPressed)
{
if((manX == 75 && manY == 175) ||
(manX == 175 && manY == 175) ||
(manX == 275 && manY == 175) ||
(manX == 375 && manY == 175) ||
(manX == 475 && manY == 175))
{
manY -= 50;
}
}
if(dPressed)
{
if((manX == 75 && manY == 175) ||
(manX == 175 && manY == 175) ||
(manX == 275 && manY == 175) ||
(manX == 375 && manY == 175) ||
(manX == 475 && manY == 175))
{
manX -= 50;
}
}
//-----BLOCK FOR THIRD ROW-----
if(wPressed)
{
if((manX == 75 && manY == 275) ||
(manX == 175 && manY == 275) ||
(manX == 275 && manY == 275) ||
(manX == 375 && manY == 275) ||
(manX == 475 && manY == 275))
{
manY += 50;
}
}
if(aPressed)
{
if((manX == 75 && manY == 275) ||
(manX == 175 && manY == 275) ||
(manX == 275 && manY == 275) ||
(manX == 375 && manY == 275) ||
(manX == 475 && manY == 275))
{
manX += 50;
}
}
if(sPressed)
{
if((manX == 75 && manY == 275) ||
(manX == 175 && manY == 275) ||
(manX == 275 && manY == 275) ||
(manX == 375 && manY == 275) ||
(manX == 475 && manY == 275))
{
manY -= 50;
}
}
if(dPressed)
{
if((manX == 75 && manY == 275) ||
(manX == 175 && manY == 275) ||
(manX == 275 && manY == 275) ||
(manX == 375 && manY == 275) ||
(manX == 475 && manY == 275))
{
manX -= 50;
}
}
//-----BLOCK FOR FOURTH ROW-----
if(wPressed)
{
if((manX == 75 && manY == 375) ||
(manX == 175 && manY == 375) ||
(manX == 275 && manY == 375) ||
(manX == 375 && manY == 375) ||
(manX == 475 && manY == 375))
{
manY += 50;
}
}
if(aPressed)
{
if((manX == 75 && manY == 375) ||
(manX == 175 && manY == 375) ||
(manX == 275 && manY == 375) ||
(manX == 375 && manY == 375) ||
(manX == 475 && manY == 375))
{
manX += 50;
}
}
if(sPressed)
{
if((manX == 75 && manY == 375) ||
(manX == 175 && manY == 375) ||
(manX == 275 && manY == 375) ||
(manX == 375 && manY == 375) ||
(manX == 475 && manY == 375))
{
manY -= 50;
}
}
if(dPressed)
{
if((manX == 75 && manY == 375) ||
(manX == 175 && manY == 375) ||
(manX == 275 && manY == 375) ||
(manX == 375 && manY == 375) ||
(manX == 475 && manY == 375))
{
manX -= 50;
}
}
//-----BLOCK FOR FIFTH ROW-----
if(wPressed)
{
if((manX == 75 && manY == 475) ||
(manX == 175 && manY == 475) ||
(manX == 275 && manY == 475) ||
(manX == 375 && manY == 475) ||
(manX == 475 && manY == 475))
{
manY += 50;
}
}
if(aPressed)
{
if((manX == 75 && manY == 475) ||
(manX == 175 && manY == 475) ||
(manX == 275 && manY == 475) ||
(manX == 375 && manY == 475) ||
(manX == 475 && manY == 475))
{
manX += 50;
}
}
if(sPressed)
{
if((manX == 75 && manY == 475) ||
(manX == 175 && manY == 475) ||
(manX == 275 && manY == 475) ||
(manX == 375 && manY == 475) ||
(manX == 475 && manY == 475))
{
manY -= 50;
}
}