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
|
Rem Project: Holes
Rem Created: 11/8/2011 4:01:01 PM
Rem Project: Holes
Rem Created: 11/8/2011 1:44:06 PM
Rem ***** Main Source File *****
Sync On
Sync Rate 30
Hide Mouse
Set Display Mode 1024,768,32
Set Window Off
`Set Variables
global State_Menu = 1
global State_Multiplayer = 2
global Player1=1
global Player2=2
global Portal1=3
global Portal2=4
global PortalView1=5
global PortalView2=6
global Bullet1=7
global Bullet2=8
global Ground=500
global CamX# = 0
global CamY# = 0
global X# = 0
global Y# = 0
global Z# = 0
global Portal2X=0
global Portal2Y=-15
global Portal2Z=44
global Portal2RotationX=0
global Portal2RotationY=180
global Portal2RotationZ=0
global IsFalling = 1
global sendMessageDelay = 0
`Player Creation
Make Object box Player1,3,9,3
Color Object Player1,RGB(000,255,000)
make camera 10
position camera 10,0,0,0
Position Object Player1, 990, 1000, 1000
Make Object Box Player2,3,9,3
Color Object Player2,RGB(255,000,000)
Position Object Player2,10,0,0
`Portals
MAKE OBJECT plain Portal1,10,10
Color Object Portal1,RGB(255,0,200)
make camera 11
position camera 11,1000,5000,1000
Position Object Portal1,-1000,-1000,-1000
MAKE OBJECT plain Portal2,10,10
Color Object Portal2,RGB(255,0,200)
make camera 12
position camera 12,1000,5000,1000
Position Object Portal2,-1000,-1000,-1000
`Bullets
Make Object Sphere Bullet1,2
Position Object Bullet1,-1000,-1000,-1000
SET OBJECT EMISSIVE Bullet1, RGB(0,0,255)
ghost object on bullet1
Make Object Sphere Bullet2,2
Position Object Bullet2,-1000,-1000,-1000
SET OBJECT EMISSIVE Bullet2, RGB(255,0,0)
`1st Floor
`ground
Make Object Box 500, 25, 5, 125
Position Object 500, 1000, 975, 1000
Color Object 500, rgb(255,0,0)
`roof
Make Object Box 624, 25, 5, 100
Position Object 624, 1000, 995, 987.5
Color Object 624, rgb(255,255,0)
`front wall
Make Object Box 1000, 25, 50, 5
Position Object 1000, 1000, 997.5, 1065
Color Object 1000, rgb(0,255,0)
`back wall
Make Object Box 1125, 25, 25, 5
Position Object 1125, 1000, 985, 935
Color Object 1125, rgb(0,0,255)
`left wall
Make Object Box 750, 5, 25, 135
Position Object 750, 985, 985, 1000
Color Object 750, rgb(255,255,255)
`right wall
Make Object Box 875, 5, 25, 135
Position Object 875, 1015, 985, 1000
Color Object 875, rgb(0,0,0)
`second floor
`ground
Make Object Box 501, 25, 5, 25
Position Object 501, 1000, 1025, 1075
Color Object 501, rgb(255,0,0)
`roof
Make Object Box 625, 25, 5, 25
Position Object 625, 1000, 1050, 1075
Color Object 625, rgb(255,255,0)
`front wall
Make Object Box 1001, 25, 30, 5
Position Object 1001, 1000, 1037.5, 1090
Color Object 1001, rgb(0,255,0)
`back wall (between levels 2 & 3)
Make Object Box 1126, 25, 75, 5
Position Object 1126, 1000, 1035, 1035
Color Object 1126, rgb(0,0,255)
`left wall (tall wall)
Make Object Box 751, 5, 110, 35
Position Object 751, 985, 1052.5, 1050
Color Object 751, rgb(255,255,255)
`right wall (tall wall)
Make Object Box 876, 5, 110, 35
Position Object 876, 1015, 1052.5, 1050
Color Object 876, rgb(0,0,0)
`left wall (small wall)
Make Object Box 752, 5, 30, 25
Position Object 752, 985, 1037.5, 1080
Color Object 752, rgb(255,255,255)
`right wall (small wall)
Make Object Box 877, 5, 30, 25
Position Object 877, 1015, 1037.5, 1080
Color Object 877, rgb(0,0,0)
`third floor
`floor part1
Make Object Box 502, 25, 5, 50
Position Object 502, 1000, 1075, 1012.5
Color Object 502, rgb(255,0,0)
`roof
Make Object Box 626, 25, 5, 80
Position Object 626, 1000, 1105, 1027.5
Color Object 626, rgb(255,255,0)
`front wall
Make Object Box 1002, 25, 50, 5
Position Object 1002, 1000, 1077.5, 1065
Color Object 1002, rgb(0,255,0)
`left wall (tall wall)
Make Object Box 753, 5, 35, 40
Position Object 753, 985, 1090, 1012.5
Color Object 753, rgb(255,255,255)
`right wall (tall wall)
Make Object Box 878, 5, 35, 40
Position Object 878, 1015, 1090, 1012.5
Color Object 878, rgb(0,0,0)
`play room
`floor
Make Object Box 503, 100, 5, 100
Position Object 503, 1000, 1075, 937.5
Color Object 503, rgb(255,0,0)
`roof
Make Object Box 627, 100, 5, 80
Position Object 627, 1000, 1150, 947.5
Color Object 627, rgb(255,255,0)
`roof left
Make Object Box 628, 37.5, 5, 20
Position Object 628, 968.75, 1150, 897.5
Color Object 628, rgb(255,255,0)
`roof right
Make Object Box 629, 37.5, 5, 20
Position Object 629, 1031.25, 1150, 897.5
Color Object 629, rgb(255,255,0)
`front wall (middle)
Make Object Box 1003, 25, 45, 5
Position Object 1003, 1000, 1130, 990
Color Object 1003, rgb(0,255,0)
`front wall (left side)
Make Object Box 1004, 37.5, 80, 5
Position Object 1004, 1031, 1112.5, 990
Color Object 1004, rgb(0,255,0)
`front wall (right side)
Make Object Box 1005, 37.5, 80, 5
Position Object 1005, 969, 1112.5, 990
Color Object 1005, rgb(0,255,0)
`back wall
Make Object Box 1127, 100, 80, 5
Position Object 1127, 1000, 1112.5, 885
Color Object 1127, rgb(0,0,255)
`platform top
Make Object Box 504, 25, 2.5, 50
Position Object 504, 1000, 1130, 912
Color Object 504, rgb(255,0,0)
`platform bottom
Make Object Box 630, 25, 2.5, 50
Position Object 630, 1000, 1127.5, 912
Color Object 629, rgb(255,255,0)
`platform left wall inner
Make Object Box 754, 2.5, 21.30, 50
Position Object 754, 986.5, 1136.90, 912.5
Color Object 754, rgb(255,255,255)
`platform left wall outer
Make Object Box 879, 2.5, 21.30, 50
Position Object 879, 983.75, 1136.90, 912.5
Color Object 879, rgb(0,0,0)
`platform right wall inner
Make Object Box 880, 2.5, 21.30, 50
Position Object 880, 1016.25, 1136.90, 912.5
Color Object 880, rgb(0,0,0)
`platform right wall outer
Make Object Box 755, 2.5, 21.30, 50
Position Object 755, 1013.75, 1136.90, 912.5
Color Object 755, rgb(255,255,255)
`left wall (room wall)
Make Object Box 758, 5, 77.5, 110
Position Object 758, 947.5, 1113.75, 937.5
Color Object 758, rgb(255,255,255)
`right wall (room wall)
Make Object Box 883, 5, 77.5, 110
Position Object 883, 1052.5, 1113.75, 937.5
Color Object 883, rgb(0,0,0)
`pipe
`back wall (leads to final room
Make Object Box 1128, 25, 60, 5
Position Object 1128, 1000, 1182.5, 885
Color Object 1128, rgb(0,0,255)
`front wall
Make Object Box 1006, 25, 30, 5
Position Object 1006, 1000, 1167.5, 910
Color Object 1006, rgb(0,255,0)
`left wall
Make Object Box 756, 5, 30, 30
Position Object 756, 985, 1167.5, 897.5
Color Object 756, rgb(255,255,255)
`right wall
Make Object Box 881, 5, 30, 30
Position Object 881, 1015, 1167.5, 897.5
Color Object 881, rgb(0,0,0)
`final room
`floor
Make Object Box 505, 25, 5, 50
Position Object 505, 1000, 1185, 932.5
Color Object 505, rgb(255,0,0)
`roof
Make Object Box 631, 25, 5, 75
Position Object 631, 1000, 1215, 920
Color Object 631, rgb(255,255,0)
`left wall
Make Object Box 757, 5, 35, 75
Position Object 757, 985, 1200, 920
Color Object 757, rgb(255,255,255)
`right wall
Make Object Box 882, 5, 35, 75
Position Object 882, 1015, 1200, 920
Color Object 882, rgb(0,0,0)
````````TEXTURECODE!``````````````
Load Image "floor.jpg",10
For LevelFloor = 500 to 505
Texture Object LevelFloor,10
Next LevelFloor
Load Image "Roof.jpg",11
For Roof = 624 to 631
Texture Object Roof,11
Next Roof
Load Image "walls.jpg",12
For LeftWall = 750 to 757
Texture Object Leftwall,12
Next Leftwall
For RightWall = 875 to 882
Texture Object Rightwall,12
Next Rightwall
Load Image "Backfrontwalls.jpg",13
For Backwall = 1125 to 1128
Texture Object Backwall,13
Next Backwall
For Frontwall = 1000 to 1006
Texture Object Frontwall,13
Next Frontwall
Load Image "fancywall.jpg",15
Texture Object 757,15
Texture Object 882,15
Texture Object 758,15
Texture Object 883,15
Load Music "Music.mp3",56789
Load Sound "Shoot.wav",1
Load Sound "Open.wav",2
Load Sound "Travel.wav",3
```Create special effects
Load Image "Effect.jpg",14
Make Particles 1,14,1,5
ghost particles on 1,50
SET PARTICLE EMISSIONS 1,1
```Create special effects
Load Image "Effect.jpg",14
Make Particles 2,14,1,5
ghost particles on 2,50
SET PARTICLE EMISSIONS 2,1
`Set State
State = State_Multiplayer
do
if State = State_Multiplayer
if keystate(59) = 1 and net game exists() = 0 `If F1 is pressed
Multiplayer_Connection()
endif
`debug()
Mechanics()
Multiplayer()
endif
sync
loop
Function Mechanics()
`````````````````
`MUSIC
````````````````
Loop Music 56789
POSITION PARTICLES 1, object position x(bullet1), object position y(bullet1), object position z(bullet1)
POSITION PARTICLES 2, object position x(bullet2), object position y(bullet2), object position z(bullet2)
`Portal Travel code
If Object Collision (Player1,Portal1)
Play sound 3
if object angle y (Portal2)=0
Position Object Player1,Object Position X(Portal2),Object Position Y(Portal2),(Object Position Z(Portal2)+10)
`yrotate object player1,0
endif
if object angle y (Portal2)=90
Position Object Player1,(Object Position X(Portal2)+10),Object Position Y(Portal2),Object Position Z(Portal2)
`yrotate object player1,90
endif
if object angle y (Portal2)=180
Position Object Player1,(Object Position X(Portal2)-10),Object Position Y(Portal2),Object Position Z(Portal2)
`yrotate object player1,180
endif
if object angle y (Portal2)=270
Position Object Player1,Object Position X(Portal2),Object Position Y(Portal2),(Object Position Z(Portal2)-10)
`yrotate object player1,260
endif
if object angle y (Portal2)=270
Position Object Player1,Object Position X(Portal2),Object Position Y(Portal2),(Object Position Z(Portal2)-10)
`yrotate object player1,260
endif
EndIf
If Object Collision (Player1,Portal2)
Play sound 3
if object angle y (Portal1)=0
Position Object Player1,Object Position X(Portal1),Object Position Y(Portal1),(Object Position Z(Portal1)+10)
`yrotate object player1,0
endif
if object angle y (Portal1)=90
Position Object Player1,(Object Position X(Portal1)+10),Object Position Y(Portal1),Object Position Z(Portal1)
`yrotate object player1,90
endif
if object angle y (Portal1)=180
Position Object Player1,(Object Position X(Portal1)-10),Object Position Y(Portal1),Object Position Z(Portal1)
`yrotate object player1,180
endif
if object angle y (Portal1)=270
Position Object Player1,Object Position X(Portal1),Object Position Y(Portal1),(Object Position Z(Portal1)-10)
`yrotate object player1,260
endif
EndIf
`Portal Visuals
SET CAMERA TO IMAGE 11,1,1024,1024,3
texture object portal2,1
SET CAMERA TO IMAGE 12,2,1024,1024,3
texture object portal1,2
`Player Move
If Scancode()=17 then move object player1,1
If Scancode()=31 then move object player1,-1
If Scancode()=30 then move object left player1,1
If Scancode()=32 then move object right player1,1
Move object down (player1),2
For LevelFloor = 500 to 505
IF Object collision (player1,LevelFloor)=1
Move object up (player1),2
ENDIF
Next LevelFloor
`left wall collisons
For LeftWall = 750 to 758
IF Object collision (player1,LeftWall)=1
position object player1,object position x(player1)+1, object position y(player1), object position z(player1)
ENDIF
Next LeftWall
`right wall collisons
For RightWall = 875 to 883
IF Object collision (player1,RightWall)=1
position object player1,object position x(player1)-1, object position y(player1), object position z(player1)
ENDIF
Next RightWall
`back wall collisons
For Backwall = 1125 to 1128
IF Object collision (player1,Backwall)=1
position object player1,object position x(player1), object position y(player1), object position z(player1)+1
ENDIF
Next Backwall
`front wall collisons
For Frontwall = 1000 to 1006
IF Object collision (player1,Frontwall)=1
position object player1,object position x(player1), object position y(player1), object position z(player1)-1
ENDIF
Next Frontwall
`Shooting and Portal Creation
Move object bullet1,2
If Mouseclick()=1
Play Sound 1
Position Object Bullet1,Object Position X(Player1),Object Position Y(Player1),Object Position Z(Player1)
yrotate object Bullet1, CAMY#
xrotate object Bullet1, CAMX#
endif
`Shooting and Portal Creation
Move object bullet2, 2
If Mouseclick()= 2 and net game exists() = 0
Play Sound 1
Position Object Bullet2,Object Position X(Player1),Object Position Y(Player1),Object Position Z(Player1)
yrotate object Bullet2, CAMY#
xrotate object Bullet2, CAMX#
endif
`Roof Portals
For Roof = 624 to 631
If Object Collision (Bullet1,Roof)
Play Sound 2
Position Object Portal1,Object Position X(Bullet1),Object Position Y(Bullet1),Object Position Z(Bullet1)
Position Object Bullet1,-1000,-1000,-1000
Position camera 11,Object Position X(Portal1),Object Position Y(Portal1),Object Position Z(Portal1)
yrotate object Portal1, 90
xrotate object Portal1, 90
zrotate object Portal1, 0
````
yrotate camera 11, 0
xrotate camera 11,90
zrotate camera 11,0
Endif
Next Roof
`Floor Portals
For LevelFloor = 500 to 505
If Object Collision (Bullet1,LevelFloor)
Play Sound 2
Position Object Portal1,Object Position X(Bullet1),Object Position Y(Bullet1),Object Position Z(Bullet1)
Position Object Bullet1,-1000,-1000,-1000
Position camera 11,Object Position X(Portal1),Object Position Y(Portal1),Object Position Z(Portal1)
yrotate object Portal1, 90
zrotate object Portal1, 90
xrotate object Portal1,0
``
yrotate camera 11,90
xrotate camera 11,0
zrotate camera 11,90
Endif
Next LevelFloor
`Left Wall Portlas
For LeftWall = 750 to 758
If Object Collision (Bullet1,LeftWall)
Play Sound 2
Position Object Portal1,Object Position X(Bullet1),Object Position Y(Bullet1),Object Position Z(Bullet1)
yrotate object Portal1, 90
xrotate object Portal1, 0
zrotate object Portal1, 0
Position camera 11,Object Position X(Bullet1),Object Position Y(Bullet1),Object Position Z(Bullet1)
Position Object Bullet1,-1000,-1000,-1000
```
yrotate camera 11, 90
zrotate camera 11, 0
xrotate camera 11, 0
Endif
Next LeftWall
`Right Wall Portals
For RightWall = 875 to 883
If Object Collision (Bullet1,RightWall)
Play Sound 2
Position Object Portal1,Object Position X(Bullet1),Object Position Y(Bullet1),Object Position Z(Bullet1)
yrotate object Portal1, 270
xrotate object Portal1, 0
zrotate object Portal1, 0
Position camera 11,Object Position X(Bullet1),Object Position Y(Bullet1),Object Position Z(Bullet1)
Position Object Bullet1,-1000,-1000,-1000
````
yrotate camera 11, 270
zrotate camera 11, 0
xrotate camera 11, 0
Endif
Next RightWall
`Forward Wall Portals
For Frontwall = 1000 to 1006
If Object Collision (Bullet1,FrontWall)
Play Sound 2
Position Object Portal1,Object Position X(Bullet1),Object Position Y(Bullet1),Object Position Z(Bullet1)
yrotate object Portal1, 180
xrotate object Portal1, 0
zrotate object Portal1, 0
Position camera 11,Object Position X(Bullet1),Object Position Y(Bullet1),Object Position Z(Bullet1)
````````````````````
yrotate camera 11, 180
zrotate camera 11, 0
xrotate camera 11, 0
Position Object Bullet1,-1000,-1000,-1000
Endif
Next FrontWall
`Back Wall Portals
For Backwall = 1125 to 1128
If Object Collision (Bullet1,Backwall)
Play Sound 2
Position Object Portal1,Object Position X(Bullet1),Object Position Y(Bullet1),Object Position Z(Bullet1)
yrotate object Portal1, 0
xrotate object Portal1, 0
zrotate object Portal1, 0
Position camera 11,Object Position X(Bullet1),Object Position Y(Bullet1),Object Position Z(Bullet1)
Position Object Bullet1,-1000,-1000,-1000
yrotate camera 11, 0
zrotate camera 11, 0
xrotate camera 11, 0
Endif
Next Backwall
`Roof Portals2
For Roof = 624 to 631
If Object Collision (Bullet2,Roof)
Play Sound 2
Position Object Portal2,Object Position X(Bullet2),Object Position Y(Bullet2),Object Position Z(Bullet2)
Position Object Bullet2,-1000,-1000,-1000
Position camera 12,Object Position X(Portal2),Object Position Y(Portal2),Object Position Z(Portal2)
yrotate object Portal2, 90
xrotate object Portal2, 90
zrotate object Portal2, 0
````
yrotate camera 12, 0
xrotate camera 12,90
zrotate camera 12,0
Endif
Next Roof
`Floor Portals2
For LevelFloor = 500 to 505
If Object Collision (Bullet2,LevelFloor)
Play Sound 2
Position Object Portal2,Object Position X(Bullet2),Object Position Y(Bullet2),Object Position Z(Bullet2)
Position Object Bullet2,-1000,-1000,-1000
Position camera 12,Object Position X(Portal2),Object Position Y(Portal2),Object Position Z(Portal2)
yrotate object Portal2, 90
zrotate object Portal2, 90
xrotate object Portal2,0
``
yrotate camera 12,90
xrotate camera 12,0
zrotate camera 12,90
Endif
Next LevelFloor
`Left Wall Portlas2
For LeftWall = 750 to 758
If Object Collision (Bullet2,LeftWall)
Play Sound 2
Position Object Portal2,Object Position X(Bullet2),Object Position Y(Bullet2),Object Position Z(Bullet2)
yrotate object Portal2, 90
xrotate object Portal2, 0
zrotate object Portal2, 0
Position camera 12,Object Position X(Bullet2),Object Position Y(Bullet2),Object Position Z(Bullet2)
Position Object Bullet2,-1000,-1000,-1000
```
yrotate camera 12, 90
zrotate camera 12, 0
xrotate camera 12, 0
Endif
Next LeftWall
`Right Wall Portals2
For RightWall = 875 to 883
If Object Collision (Bullet2,RightWall)
Play Sound 2
Position Object Portal2,Object Position X(Bullet2),Object Position Y(Bullet2),Object Position Z(Bullet2)
yrotate object Portal2, 270
xrotate object Portal2, 0
zrotate object Portal2, 0
Position camera 12,Object Position X(Bullet2),Object Position Y(Bullet2),Object Position Z(Bullet2)
Position Object Bullet2,-1000,-1000,-1000
````
yrotate camera 12, 270
zrotate camera 12, 0
xrotate camera 12, 0
Endif
Next RightWall
`Forward Wall Portals2
For Frontwall = 1000 to 1006
If Object Collision (Bullet2,FrontWall)
Play Sound 2
Position Object Portal2,Object Position X(Bullet2),Object Position Y(Bullet2),Object Position Z(Bullet2)
yrotate object Portal2, 180
xrotate object Portal2, 0
zrotate object Portal2, 0
Position camera 12,Object Position X(Bullet2),Object Position Y(Bullet2),Object Position Z(Bullet2)
````````````````````
yrotate camera 12, 180
zrotate camera 12, 0
xrotate camera 12, 0
Position Object Bullet2,-1000,-1000-,1000
Endif
Next FrontWall
`Back Wall Portals2
For Backwall = 1125 to 1128
If Object Collision (Bullet2,Backwall)
Play Sound 2
Position Object Portal2,Object Position X(Bullet2),Object Position Y(Bullet2),Object Position Z(Bullet2)
yrotate object Portal2, 0
xrotate object Portal2, 0
zrotate object Portal2, 0
Position camera 12,Object Position X(Bullet2),Object Position Y(Bullet2),Object Position Z(Bullet2)
Position Object Bullet2,-1000,-1000,-1000
yrotate camera 12, 0
zrotate camera 12, 0
xrotate camera 12, 0
Endif
Next Backwall
`FPS Camera!!
Position Camera 10,Object Position X(Player1),Object Position Y(Player1),Object Position Z(Player1)
`Mouselook
CAMY#=CAMY#+MouseMoveX()*.1
CAMX#=CAMX#+MouseMoveY()*.1
If CAMX#>90 and CAMX#<135 then CAMX#=90
If CAMX#>270 and CAMX#<225 then CAMX#=90
yrotate camera 10,CAMY#
xrotate camera 10,CAMX#
yrotate object player1,CAMY#
`xrotate object player1,CAMX#
`HUD
Circle Screen Width()/2,Screen Height()/2,5
EndFunction
Function Multiplayer_Connection()
`Retrieve the TCP/IP Connection Number
tcpip_num AS INTEGER
perform checklist for net connections
for i = 1 to checklist quantity()
if left$(checklist string$(i),15) = "Internet TCP/IP"
tcpip_num = i
endif
next i
`Find out if our user is a host or a client
userType AS STRING
clientIP AS STRING
print " "
print " "
print " "
print "Would you like to Create (Press 'c') or Join (Press 'j') a game?"
print " "
print "---NOTE---"
print " Firewall on both computers must be disabled in order to play online!"
sync
repeat
if lower$(inkey$()) = "j"
userType = "client"
print "What IP address are you connecting to? (Press any key to continue)"
print " "
print " "
print " ---How to find and input IP Address of game creator---"
print " "
print "To obtain IP address of computer creating the game"
print "1. Press Windows Start button on game creators computer"
print "2. Type 'cmd' in search"
print "3. In cmd, type 'ipconfig'"
print "4. Search for IPv4 Address"
print "5. Input IPv4 Address into gamscreen"
print " "
print "(Press any Key to Continue and enter IP Address)"
sync
wait key
cls
input clientIP
cls
endif
if lower$(inkey$()) = "c"
userType = "host"
endif
until userType <> ""
`Setup Connection
if userType = "host"
set net connection tcpip_num, " "
else
if userType = "client"
set net connection tcpip_num, clientIP
else
exit prompt "User type not specified","Multiplayer Error"
end
endif
endif
`Prompt the user for a name
playerName AS STRING
print "What would you like to call yourself? (Press any key to continue and input Name)"
sync
wait key
cls
repeat
input playerName
sync
until playerName <> ""
`Host: Create new game
if userType = "host"
create net game "Game", playerName, 2
mptype = 1
endif
`Find session
sessionID AS INTEGER
perform checklist for net sessions
join net game 2, playerName
endfunction
Function Multiplayer()
if memblock exist(1)
delete memblock 1
endif
`sets variables for message
X# as Dword
X# = int(object position x(Player1))
Y# as Dword
Y# = int(object position y(Player1))
Z# as Dword
Z# = int(object position z(Player1))
BulletX# as Dword
BulletX# = int(object position x(Bullet1))
BulletY# as Dword
BulletY# = int(object position y(Bullet1))
BulletZ# as Dword
BulletZ# = int(object position z(Bullet1))
AngleX# as Dword
AngleX# = int(object angle x(bullet1))
AngleY# as Dword
AngleY# = int(object angle y(bullet1))
AngleZ# as Dword
AngleZ# = int(object angle z(bullet1))
make memblock 1, 36
write memblock Dword 1, 0, X#
write memblock Dword 1, 4, Y#
write memblock Dword 1, 8, Z#
write memblock Dword 1, 12, BulletX#
write memblock Dword 1, 16, BulletY#
write memblock Dword 1, 20, BulletZ#
write memblock Dword 1, 24, AngleX#
write memblock Dword 1, 28, AngleY#
write memblock Dword 1, 32, AngleZ#
`inc sendMessageDelay
`if sendMessageDelay >= 100
`send player coordinates when movement keys are pressed
If Scancode()=17
send net message Memblock 0, 1, 1
endif
If Scancode()=31
send net message Memblock 0, 1, 1
endif
If Scancode()=30
send net message Memblock 0, 1, 1
endif
If Scancode()=32
send net message Memblock 0, 1, 1
endif
`endif
if mouseclick() = 1
send net message Memblock 0, 1, 1
endif
`resets delay for message send
`sendMessageDelay = 0
`checks to see if there are any waiting messages
get net message
if net message exists() = 1
`checks the type of message. Checks for 'Memblock' msgs
if net message type() = 4
net message Memblock 1
position object Player2, memblock Dword (1, 0), memblock Dword (1, 4), memblock Dword (1,
xrotate object Bullet2, memblock Dword (1, 24)
yrotate object Bullet2, memblock Dword (1, 28)
zrotate object Bullet2, memblock Dword (1, 32)
position object Bullet2, memblock Dword (1, 12), memblock Dword (1, 16), memblock Dword (1, 20)
endif
endif
`Checks for players in game session and displays them on screen when tab is pressed
if keystate(15) = 1
Perform Checklist For Net Players
If Checklist Quantity() > 0
Name$ = ""
For N = 1 To Checklist Quantity()
Name$ = Name$ + Checklist string$(N)+" "
Next p
Text 10, 350, "--Current Players-- "
Text 10, 380, Name$
Endif
endif
endfunction
function debug()
text 1,1, "bullet rotation X:" + str$(object angle x(bullet2))
text 1,20, "bullet rotation y:" + str$(object angle y(bullet2))
text 1,40, "bullet rotation z:" + str$(object angle z(bullet2))
endfunction
Rem ***** Main Source File *****
|