-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgame.bb
2369 lines (1452 loc) · 39.8 KB
/
game.bb
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
Global g_3ds_win_width=300
Global g_3ds_win_height=400
Global g_winwidth=300
Global g_winwidth2=150
Global g_winheight=400
Global g_winheight2=200
Const playfieldw=64
Const playfieldh=64
Global playfieldmaxx=playfieldw-1
Global playfieldmaxy=playfieldh-1
Global maxx
Global maxy
Const blockw=128
Const blockh=128
Const blockw2=64
Const blockh2=64
Global blockwonscreen=g_winwidth/blockw
Global blockhonscreen=g_winheight/blockw
Global blockwonscreen2=g_winwidth/blockw2
Global blockhonscreen2=g_winheight/blockw2
Global lastblockx=-1
Global lastblocky=-1
Global thisblockx=-1
Global thisblocky=-1
Global testangle#=0
Global newdbgx,newdbgy
Const effect_tree=1
Const effect_smoke=10
Const c_dieing_timer=250
Dim keyset_up(3)
Dim keyset_down(3)
Dim keyset_left(3)
Dim keyset_right(3)
Dim keyset_fire(3)
Dim players.playerdef(100)
Global players_numberoff
Const door_open_thresshold=50
Const door_closed_mask=45
Type Playerdef
Field lastx,lasty
Field x#,y#
Field camerax,cameray
Field camerax0,cameray0
Field camerax1,cameray1
Field dx#,dy#
Field angle#, lastangle#
Field speed#
Field lives
Field damage
Field maxdamage
Field turning
Field alliedcode
Field hasflag,flagblock.blockdef
Field homecode
Field tanksoundchannel1
Field tanksoundchannel2
;when draw several times, calculate only once
Field drawmem_frame
Field drawmem_x
Field drawmem_y
;playfield window
Field pf_x0
Field pf_y0
Field pf_w
Field pf_h
Field pf_wd2
Field pf_hd2
Field dieing
End Type
Type collisiondef
Field collided.blockdef
Field driveover.blockdef
End Type
Global colisioninfo.collisiondef
Const bkt_cannon=1
Const bkt_tree=2
Const bkt_building=3
Const bkt_door=4
Const bkt_rubble=40
Function InitLevel(level)
keyset_fire(1)=key_space
keyset_up(1)= key_cursup
keyset_down(1)= key_cursdown
keyset_left(1)= key_cursleft
keyset_right(1)= key_cursright
;keyset for player 2
keyset_fire(2)= 30; a
keyset_up(2)= 19; r
keyset_down(2)= 33; f
keyset_left(2)= 32; d
keyset_right(2)= 34; g
;alternate keyset for player 2
;keyset_fire(2)= 82
;keyset_up(2)= 72
;keyset_down(2)= 80;80 or 76
;keyset_left(2)= 75
;keyset_right(2)= 77
newdbgx=0
newdbgy=0
;0-15 = road
; up=1
; down=2
; left=4
; right=8
floorcodetable( 0)=0 ; does not exist
floorcodetable( 1)=0 ; does not exist
floorcodetable( 2)=0 ; does not exist
floorcodetable( 3)=16 ;vertical
floorcodetable( 4)=0
floorcodetable( 5)=13
floorcodetable( 6)=7
floorcodetable( 7)=10
floorcodetable( 8)=0 ; does not exist
floorcodetable( 9)=11
floorcodetable(10)=5
floorcodetable(11)=8
floorcodetable(12)=15 ; horizontal
floorcodetable(13)=12
floorcodetable(14)=6
floorcodetable(15)=0 ; does not exist
mapfile$="t"+level
LoadOldLevel("data\level\"+mapfile$)
End Function
Function LoadOldLevel(filename$)
filein = ReadFile(filename$)
;clear blocks
For x=0 To playfieldw-1
For y=0 To playfieldh-1
worldblks(x,y)\image=0
worldblks(x,y)\mskimage=0
worldblks(x,y)\floorimage=0
worldblks(x,y)\blocktype=0; 0 means nothing
worldblks(x,y)\status=0
worldblks(x,y)\damage=0
worldblks(x,y)\overlayoffsetx=0
worldblks(x,y)\overlayoffsety=0
worldblks(x,y)\effect=0
worldblks(x,y)\effect2last=0
worldblks(x,y)\effect2=0
worldblks(x,y)\alliedcode=-1
worldblks(x,y)\hasflag=0
Next
Next
For x=0 To playfieldw-1
For y=0 To playfieldh-1
byte = ReadByte( filein )
worldblks(x,y)\debug=byte
worldblks(x,y)\code=byte
justfloor=0
If( (byte >=5 And byte <=16)) ;the road
worldblks(x,y)\floorimage=byte
justfloor=1
ElseIf (byte=44 Or byte=67) ;buildings with road
worldblks(x,y)\floorimage=15
EndIf
If(justfloor=0) Then
worldblks(x,y)\image=byte
worldblks(x,y)\mskimage=byte
EndIf
;flag building
If byte=89 Or byte=92 Then
worldblks(x,y)\hasflag=1
If(byte=89 )
worldblks(x,y)\alliedcode=1
Else
worldblks(x,y)\alliedcode=2
EndIf
EndIf
;doors
If byte=44 Or byte=67 Then
worldblks(x,y)\blocktype=bkt_door
If(byte=44 )
worldblks(x,y)\alliedcode=1
Else
worldblks(x,y)\alliedcode=2
EndIf
;Stop
worldblks(x,y)\mskimage=door_closed_mask
;worldblks(x,y)\image=70
EndIf
;cannons
If(byte=27 Or byte=39 Or byte=41 Or byte=43 Or byte=48 Or byte=50 Or byte=64 Or byte=66 Or byte=71 Or byte=73 Or byte=85 Or byte=87)
worldblks(x,y)\blocktype=bkt_cannon
If(byte=27 Or byte=41 Or byte=43 Or byte=48 Or byte=50 Or byte=85)
worldblks(x,y)\alliedcode=1
Else
worldblks(x,y)\alliedcode=2
EndIf
xoff=0
yoff=0
If(byte=50 Or byte=48 Or byte=43 Or byte=85) Then
xoff=-3
yoff=2
EndIf
If(byte=41) Then
xoff=-4
EndIf
If(byte=43) Then
xoff=-4
EndIf
If(byte=64 Or byte=73 Or byte=87 Or byte=66 Or byte=71) Then
xoff=-5
yoff=0
EndIf
worldblks(x,y)\overlayoffsetx=xoff
worldblks(x,y)\overlayoffsety=yoff
EndIf
If(byte=17 Or byte=18 Or byte=19 Or byte=20 Or byte=22 Or byte=24 Or byte=25 Or byte=29 Or byte=30 Or byte=31 Or byte=32 Or byte=34 Or byte=36 Or byte=37 Or byte=89 Or byte=92)
worldblks(x,y)\blocktype=bkt_building
EndIf
If(byte=2 Or byte=3 Or byte=4)
worldblks(x,y)\blocktype=bkt_tree
EndIf
Next
Next
End Function
Function findblockpos(code,bpos.blockpos)
bpos\xindex=0
bpos\yindex=0
For x=0 To playfieldw-1
For y=0 To playfieldh-1
If(worldblks(x,y)\code=code) Then
bpos\xindex=x
bpos\yindex=y
Return
EndIf
Next
Next
bpos\xindex=0
bpos\yindex=0
End Function
Function InitPlayer(player.playerdef)
;Stop
If(player\hasflag>0) Then
player\flagblock\hasflag=1
EndIf
player\hasflag=0
bpos.blockpos=New blockpos
player\dx#=0
player\dy#=0
player\angle#=90
player\speed#=0
player\lives=3
home=20
If(player\alliedcode<>1) Then
home=32
EndIf
findblockpos(home,bpos)
player\x= (bpos\xindex*blockw) + blockw/2
player\y= (bpos\yindex*blockh) + blockh
player\lastx=player\x
player\lasty=player\y
player\damage=0
player\maxdamage=2
player\hasflag=0
player\homecode=home
If(player\tanksoundchannel1<> 0 ) Then
StopChannel (player\tanksoundchannel1)
StopChannel (player\tanksoundchannel2)
player\tanksoundchannel1=0
player\tanksoundchannel2=0
EndIf
ch1=PlaySound (gsfx_tengine1)
player\tanksoundchannel1=ch1
ch2=PlaySound (gsfx_tengine1)
player\tanksoundchannel2=ch2
player\dieing=0
Delete bpos
End Function
Function maketrackparticles(player.playerdef)
tspeed#=player\speed ; Sqr ((player\dx*player\dx) + (player\dy*player\dy))
ticker=6
If((tspeed>5 Or player\turning=1) And ticker>3) Then
ticker=0
For t=1 To 3
a45=Rand(0,1)
If(a45=0) Then
a45=20
Else
a45=-20
EndIf
pa#=ATan2 (player\dx,player\dy)
ang#=ATan2 (player\dx,player\dy)
ang=180+(ang)+a45
off=20
If(player\turning=1) Then off=Rand(-15,10)
xoffset#=Sin(ang)*(off+t)
yoffset#=Cos(ang)*(off+t)
a2=45+Rand(-5,5)
dist#=Rand(1,10)
xs#=Sin(a2)*dist
ys#=Cos(a2)*dist
newSimplePixParticle0.pixpartdef0(player\x+xoffset,player\y+yoffset,xs,ys, 1,0,Rand(2000)+1000)
Next
EndIf
End Function
Function makedustparticles(player.playerdef)
tspeed#=player\speed
ticker=6
If((tspeed>3) And ticker>3) Then
offx1=0
offy1=0
ticker=0
For t=1 To 360
dist#=Rand(0,400) / 10
xoffset=offx1+Sin(t)*dist
yoffset=offy1+Cos(t)*dist
xs#=.5+Sin(t)/2
ys#=.5+Cos(t)/2
newSimplePixParticle.pixpartdef(player\x+g_winwidth2+xoffset,player\y+g_winheight2+yoffset,xs,ys, 1,100+Rand(100),Rand(2000)+1000)
Next
EndIf
End Function
Function SetPlayerCamera(player.playerdef,xoff,yoff)
player\camerax=player\x-xoff
player\cameray=player\y-yoff
player\camerax0=player\camerax-g_winwidth2
player\cameray0=player\cameray-g_winheight2
End Function
Function Game()
Game_2P()
End Function
Function Game_1P()
dashboardbg=LoadImage ("data\gfx\dashboardbg2.png")
level=4
;InitLevel(1)
;InitLevel(2)
;InitLevel(3)
InitLevel(Rand(1,5))
;InitLevel(5)
player1.playerdef = New playerdef
player1\tanksoundchannel1=0
player1\tanksoundchannel2=0
player1\alliedcode=1
Initplayer(player1)
player1\pf_x0=7
player1\pf_y0=10
player1\pf_w=626
player1\pf_h=350
player1\pf_wd2=314
player1\pf_hd2=175
colisioninfo=New collisiondef
image=tankleft
maxx=(playfieldw*blockw)-1
maxy=(playfieldh*blockh)-1
minx=1*blockw
miny=1*blockh
players(0)=player1
players_numberoff=1
;Stop
ticker=0
While Not KeyHit(key_escape)
If(KeyHit(28)) Then g_debugstop=1
If(KeyHit(16)) Then
effects_explode(player1\x,player1\y)
EndIf
;draw--------------------------------------------
DrawDashBoard(dashboardbg)
DrawPlayfield(player1)
;DrawPlayfield(player2)
ResetViewPort()
HandlePlayer(player1)
;HandlePlayer(player2)
movebullets()
movepixparticles(player1\x,player1\y)
Move3DSprites(-player1\x,-player1\y,0,0,False )
LimitFPS()
Flip
Wend
FreeImage dashboardbg
If(player1\tanksoundchannel1<> 0 ) Then
StopChannel (player1\tanksoundchannel1)
StopChannel (player1\tanksoundchannel2)
player1\tanksoundchannel1=0
player1\tanksoundchannel2=0
EndIf
End Function
Function Game_2P()
dashboardbg=LoadImage ("data\gfx\dashboardbg2.png")
level=4
;InitLevel(1)
;InitLevel(2)
;InitLevel(3)
InitLevel(Rand(1,5))
;InitLevel(5)
player1.playerdef = New playerdef
player1\tanksoundchannel1=0
player1\tanksoundchannel2=0
player1\alliedcode=1
Initplayer(player1)
player1\pf_x0=7
player1\pf_y0=10
player1\pf_w=310
player1\pf_h=350
player1\pf_wd2=150
player1\pf_hd2=175
player2.playerdef = New playerdef
player2\tanksoundchannel1=0
player2\tanksoundchannel2=0
player2\alliedcode=2
Initplayer(player2)
player2\pf_x0=323
player2\pf_y0=10
player2\pf_w=310
player2\pf_h=350
player2\pf_wd2=150
player2\pf_hd2=175
colisioninfo=New collisiondef
image=tankleft
maxx=(playfieldw*blockw)-1
maxy=(playfieldh*blockh)-1
minx=1*blockw
miny=1*blockh
players(0)=player1
players(1)=player2
players_numberoff=2
;Stop
ticker=0
While Not KeyHit(key_escape)
If(KeyHit(28)) Then g_debugstop=1
If(KeyHit(16)) Then
effects_explode(player1\x,player1\y)
EndIf
;draw--------------------------------------------
DrawDashBoard(dashboardbg)
DrawPlayfield(player1)
DrawPlayfield(player2)
ResetViewPort()
HandlePlayer(player1)
HandlePlayer(player2)
movebullets()
movepixparticles(player1\x,player1\y)
Move3DSprites(-player1\x,-player1\y,-player2\x,-player2\y,True )
LimitFPS()
Flip
Wend
FreeImage dashboardbg
If(player1\tanksoundchannel1<> 0 ) Then
StopChannel (player1\tanksoundchannel1)
StopChannel (player1\tanksoundchannel2)
player1\tanksoundchannel1=0
player1\tanksoundchannel2=0
EndIf
If(player2\tanksoundchannel1<> 0 ) Then
StopChannel (player2\tanksoundchannel1)
StopChannel (player2\tanksoundchannel2)
player2\tanksoundchannel1=0
player2\tanksoundchannel2=0
EndIf
End Function
Function handletileevents(player.playerdef,playerid,driveoverblock.blockdef)
xx=player\camerax0
yy=player\cameray0
basesrcy=yy/blockh
basesrcx=xx/blockw
bw2=blockw/2
bh2=blockh/2
offy=((basesrcy)*blockh);-yy
offx=((basesrcx)*blockw);-xx
For y=0 To blockhonscreen+1
blockposy=offy + y*blockh
;srcy=basesrcy+y
srcy=TiledRange(basesrcy+y,0,playfieldmaxy)
If((srcy)<0 Or (srcy)>playfieldh) Then
;
Else
For x=0 To blockwonscreen+1
;srcx=basesrcx+x
srcx=TiledRange(basesrcx+x,0,playfieldmaxx)
blockposx=offx + x*blockw
If(Not((srcx)<0 And (srcx)>playfieldw)) Then
block.blockdef=worldblks(srcx,srcy)
If(block\effect2last) Then
block\effect2last=block\effect2last-1
If(block\effect2last=0) Then
block\effect2=0
EndIf
EndIf
If(block\blocktype=bkt_door And driveoverblock<>block)
block\status=block\status-1
If(block\status<0) Then block\status=0
If(block\status<door_open_thresshold) Then
block\mskimage=door_closed_mask
EndIf
EndIf
If(block\effect2=effect_smoke) Then
;Stop
If(block\effect2last Mod 5 = 0) Then
xefx=(srcx*blockw)+blockw2
yefx=(srcy*blockh)+blockh2
;xefx=xxpl+(blockposx+blockw2)
;yefx=yypl+(blockposy+blockh2)
size=Rand(20,50)
h=New3DSprite(xefx,yefx,size,size,g_smoketexture,0 ,0,1.0,Rand(0,360),1)
Set3DSpriteVelocity(h,.7,.7)
Set3DSpriteFade(h,0.984)
Set3DSpriteBlowup(h,1.001)
EndIf
EndIf
;
If(block\blocktype=bkt_cannon) Then
dx#=(blockposx+bw2)-(player\x)
dy#=(blockposy+bh2)-(player\y)
a#=ATan2(dy,dx)+(180)
If(a#<0) Then a#=a#+360
If(a#>360) Then a#=a#-360
;a#=a#/45
dist#=Sqr((dx*dx)+(dy*dy))
block\effect=Int(a#)
;Stop
If(dist<250 And (playerid <> block\alliedcode)) Then
dontshoot=dontshoot-1
If(dontshoot<0) Then
dontshoot=50
a2#=((Int (block\effect) / 45) * 45)
dx#=Cos(a2)*6
dy#=Sin(a2)*6
xoff=xxpl + Cos(a2)*50
yoff=yypl + Sin(a2)*50
b.bulletdef=newSimpleBullet(xoff+blockposx+bw2,yoff+blockposy+bh2,dx,dy,0)
PlaySound gsfx_cannon
EndIf
EndIf
EndIf
EndIf
Next
EndIf
Next
End Function
Function HandlePlayer(player.playerdef)
;handle input-------------------------------------
If(player\dieing=0) Then
handleTankInput(player,player\alliedcode)
maketrackparticles(player)
player\x=TiledRange(player\x,0,maxx)
player\y=TiledRange(player\y,0,maxy)
;collisionss - tank with world
collission=collidePlayerWorld(player)
handlecollision(player,collission)
Else
player\dieing=player\dieing-1
If(player\dieing=0) Then
InitPlayer(player)
EndIf
EndIf
;collisions - bullets with world
collidebulletsworld1(player)
;handle events-------------------------------------
handletileevents(player,player\alliedcode,colisioninfo\driveover)
End Function
Function handleTankInput(player.playerdef,keyset)
breaking=0
turning=0
driving=0
slowing=1
changetarget=0
backing=0
tdx=0
tdy=0
targetangle#=0
player\lastx=player\x
player\lasty=player\y
player\lastangle=player\angle
; keyset_fire(1)=key_space
; keyset_up(1)= key_cursup
; keyset_down(1)= key_cursdown
; keyset_left(1)= key_cursleft
; keyset_right(1)= key_cursright
If(InputPressed(keyset_fire(keyset))) Then
speed#=15
dx#=Cos(player\angle) * speed
dy#=Sin(player\angle) * speed
xoff#=Cos(player\angle) * (35 + player\speed)
yoff#=Sin(player\angle) * (35 + player\speed)
b.bulletdef=newSimpleBullet(xoff+player\x,yoff+player\y,dx,dy,1)
PlaySound(gsfx_explosion5)
EndIf
If(InputDown(keyset_left(keyset))) Then
tdx=-1
changetarget=1
EndIf
If((InputDown(keyset_right(keyset)))) Then
tdx=1
changetarget=1
EndIf
updown=0
If((InputDown(keyset_up(keyset)))) Then
tdy=-1
changetarget=1
Else If(InputDown(keyset_down(keyset))) Then
tdy=1
leftright=-leftright
changetarget=1
EndIf
targetangle#=ATan2(tdy,tdx)
difangle#=Abs(AngleCompare(targetangle,player\angle))
If(changetarget>0) Then
slowing=0
driving=1
If(difangle>175) Then
backing=1
player\speed=-1
Else
If(difangle > 80) Then
driving=0
If(player\speed# > 0.5)
breaking=1
Else
turning =1
EndIf
ElseIf(difangle > 0.5) Then
player\speed=player\speed*.9
turning=1
EndIf
EndIf
EndIf
If(slowing=1) Then
player\speed=player\speed*.95
ElseIf(breaking =1) Then
player\speed=player\speed*.57
ElseIf(driving=1) Then
player\speed#=(player\speed# +.3 )
If(player\speed > 10) Then
player\speed=10
EndIf
EndIf
If(turning=1) Then
player\angle=Turn(player\angle, targetangle, 5)
EndIf
player\dx#=Cos(player\angle)* player\speed
player\dy#=Sin(player\angle)* player\speed
player\turning=turning
rev2#=player\speed Mod 20
gear=player\speed/20
If(rev>10) Then rev2=rev2+(2*gear)
hertz#=4000 + (rev2*500)
ChannelPitch player\tanksoundchannel1, hertz
ChannelPitch player\tanksoundchannel2, hertz +2000
player\x=player\x+player\dx
player\y=player\y+player\dy
SetPlayerCamera(player,0,0)