-
Notifications
You must be signed in to change notification settings - Fork 1
/
thingfuncs.agc
3592 lines (3110 loc) · 130 KB
/
thingfuncs.agc
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
/*
This file is part of SkeletonFPS.
SkeletonFPS is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
SkeletonFPS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with SkeletonFPS. If not, see <http://www.gnu.org/licenses/>.
Author:Creamcast
URL:https://github.com/creamcast/SkeletonFPS
*/
function TemplateController(tgame ref as Game, things ref as Thing[], this as integer)
select things[this].state
case STATE_INIT
things[this].state = STATE_MAIN
endcase
case STATE_MAIN
endcase
endselect
endfunction
function ProgLvlSelect(tgame ref as Game, things ref as Thing[], this as integer)
select things[this].state
case STATE_INIT
pos as Coord2d
text as integer
lvlnow as integer
things[this].vars[V_LVLSELECT_MAX] = 30// ReadLevel()
if things[this].vars[V_LVLSELECT_MAX] < 1
// things[this].vars[V_LVLSELECT_MAX] = 1
endif
things[this].vars[V_LVLSELECT_CLVL] = things[this].vars[V_LVLSELECT_MAX]
lvlnow = things[this].vars[V_LVLSELECT_CLVL]
AddVirtualButton(VBUTTON1, 0 + 128, tgame.window_height/2, 128)
AddVirtualButton(VBUTTON2, tgame.window_width - 128, tgame.window_height/2, 128)
AddVirtualButton(VBUTTON3, tgame.window_width/2, tgame.window_height - 128, 128)
SetVirtualButtonImageUp(VBUTTON1, IMG_MEBTNLEFTUP)
SetVirtualButtonImageUp(VBUTTON2, IMG_MEBTNRIGHTUP)
SetVirtualButtonImageDown(VBUTTON1, IMG_MEBTNLEFTDN)
SetVirtualButtonImageDown(VBUTTON2, IMG_MEBTNRIGHTDN)
SetVirtualButtonAlpha(VBUTTON1, 255)
SetVirtualButtonAlpha(VBUTTOn2, 255)
things[this].vars[V_LVLSELECT_TEXT] = CreateText("LEVEL " + AddZeros(2,STR(lvlnow)))
text = things[this].vars[V_LVLSELECT_TEXT]
SetTextFontImage(text, IMG_MAINFONT)
SetTextSize(text, 80)
GetHudPos(tgame, GetTextTotalWidth(text), GetTextTotalHeight(text), POS_CENTER, pos)
SetTextPosition(text, pos.x,pos.y)
//create title
title as integer
title = CreateText("SELECT LEVEL")
SetTextFontImage(title, IMG_MAINFONT)
SetTextSize(title, 48)
GetHudPos(tgame, GetTextTotalWidth(title), GetTextTotalHeight(title), POS_TOPCENTER, pos)
SetTextPosition(title, pos.x,pos.y)
//create bg
bg as integer
bg = CreateSprite(IMG_GRASS)
SetSpriteUVScale( bg, 0.4, 0.4 )
SetImageWrapU ( IMG_GRASS, 1 )
SetImageWrapV ( IMG_GRASS, 1 )
SetSpriteSize(bg, tgame.window_width, tgame.window_height)
things[this].state = STATE_MAIN
endcase
case STATE_MAIN
level as integer
If GetVirtualButtonPressed(VBUTTON1) = 1
dec things[this].vars[V_LVLSELECT_CLVL], 1
if things[this].vars[V_LVLSELECT_CLVL] <= 0
things[this].vars[V_LVLSELECT_CLVL] = things[this].vars[V_LVLSELECT_MAX]
endif
level = things[this].vars[V_LVLSELECT_CLVL]
PlaySound(SND_SHOT)
elseif GetVirtualButtonPressed(VBUTTON2) = 1
inc things[this].vars[V_LVLSELECT_CLVL], 1
if things[this].vars[V_LVLSELECT_CLVL] > things[this].vars[V_LVLSELECT_MAX]
things[this].vars[V_LVLSELECT_CLVL] = 1
endif
level = things[this].vars[V_LVLSELECT_CLVL]
PlaySound(SND_SHOT)
elseif GetVirtualButtonPressed(VBUTTON3) = 1
PlaySound(SND_EXPLODE)
things[this].state = STATE_DEAD
endif
if level <> 0
SetTextString(things[this].vars[V_LVLSELECT_TEXT], "LEVEL " + AddZeros(2,STR(level)))
endif
endcase
case STATE_DEAD
if things[this].vars[V_LVLSELECT_CLVL] = 30
ChangeScene(tgame, SCENE_EDITOR)
else
tgame.currentslot = things[this].vars[V_LVLSELECT_CLVL] - 1
ChangeScene(tgame, SCENE_LVLDISPLAY)
endif
endcase
endselect
endfunction
function ProgChangeScene(tgame ref as Game, things ref as Thing[], this as integer)
select things[this].state
case STATE_INIT
if things[this].vars[V_CHANGESCENE_WAIT] = 0 then things[this].vars[V_CHANGESCENE_WAIT] = 1000
things[this].vars[V_CHANGESCENE_NEXTTIME] = things[this].vars[V_CHANGESCENE_WAIT] + tgame.ms
things[this].state = STATE_MAIN
endcase
case STATE_MAIN
If tgame.ms > things[this].vars[V_CHANGESCENE_NEXTTIME]
things[this].state = STATE_DEAD
endif
endcase
case STATE_DEAD
ChangeScene(tgame, things[this].vars[V_CHANGESCENE_SCENENEXT])
ClearThing(things, this)
endcase
endselect
endfunction
function ProgExit(tgame ref as Game, things ref as Thing[], this as integer)
select things[this].state
case STATE_INIT
x as integer
z as integer
i as integer
gemcount as integer
x = things[this].vars[V_EXIT_INITX]
z = things[this].vars[V_EXIT_INITZ]
things[this].vars[V_EXIT_SECONDPART] = CloneTObject(tgame, TMPL_EXIT2)
SetObjectTransparency(things[this].vars[V_EXIT_SECONDPART], 1)
SetObjectCollisionMode(things[this].vars[V_EXIT_SECONDPART],0)
SetObjectPosition(things[this].id, x, 0, z)
SetObjectPosition(things[this].vars[V_EXIT_SECONDPART], x, 0, z)
SetObjectVisible(things[this].vars[V_EXIT_SECONDPART], 0) //hide it until player gets all gems
//count num gems
for i = T_ENEMYSTART to T_ENEMYEND
if things[i].used = YES
inc gemcount
endif
next
things[this].vars[V_EXIT_GEMREQ] = gemcount
things[this].state = STATE_MAIN
endcase
case STATE_MAIN
if things[T_PLAYER].used = YES and things[T_INVENTORY].used = YES
thisobj as ObjInfo
GetObjectInfo(things[this].id, thisobj)
if ObjectSphereCast(things[T_PLAYER].id, thisobj.x,thisobj.y,thisobj.z, thisobj.x,thisobj.y+1,thisobj.z, 1)
if things[T_INVENTORY].vars[V_INVENTORY_GEMS] = things[this].vars[V_EXIT_GEMREQ]
ShowMessage(things, 16, POS_CENTER, 2000, 32)
things[this].vars[V_EXIT_NEXTTIME] = tgame.ms + 2500
things[this].state = STATE_DEAD
PlaySound(SND_COMPLETE)
else
if things[T_HUDMSG].used = NO
PlaySound(SND_ERROR)
ShowMessage(things, 18, POS_CENTER, 2500, 28)
endif
endif
endif
if things[T_INVENTORY].vars[V_INVENTORY_GEMS] = things[this].vars[V_EXIT_GEMREQ]
uselight as integer
SetObjectVisible(things[this].vars[V_EXIT_SECONDPART], 1) //reveal it when player gets all gems
if things[this].vars[V_EXIT_LIGHT] = 0
ShowMessage(things, 19, POS_CENTER, 2000, 24) //show gate activated message
uselight = GetEmptyLight(LIGHTSTART, LIGHTEND)
if uselight <> -1
CreatePointLight(uselight, GetObjectX(things[this].id), 3, GetObjectZ(things[this].id), 25, 100, 255, 255)
SetPointLightMode(uselight, 1)
things[this].vars[V_EXIT_LIGHT] = uselight
PlaySound(SND_GATE)
endif
endif
endif
endif
endcase
case STATE_DEAD
if tgame.ms > things[this].vars[V_EXIT_NEXTTIME]
tgame.carry_coin = things[T_INVENTORY].vars[V_INVENTORY_COINS]
ChangeScene(tgame, 4) //goto next level
if things[this].vars[V_EXIT_LIGHT] <> 0
DeletePointLight(things[this].vars[V_EXIT_LIGHT])
endif
ClearThing(things, this)
endif
endcase
endselect
endfunction
function ProgCrosshair(tgame ref as Game, things ref as Thing[], this as integer)
select things[this].state
case STATE_INIT
pos as Coord2D
spriteid as integer
things[this].vars[V_CROSSHAIR_SID] = CreateSprite(IMG_CROSSHAIR)
spriteid = things[this].vars[V_CROSSHAIR_SID ]
SetSpriteSize(spriteid, 32, 32)
GetHudPos(tgame, GetSpriteWidth(spriteid), GetSpriteHeight(spriteid), POS_CENTER, pos)
SetSpritePosition(spriteid, pos.x,pos.y)
SetSpriteVisible(things[this].vars[V_CROSSHAIR_SID], 0)
things[this].vars[V_CROSSHAIR_HIDDEN] = 1
things[this].state = STATE_MAIN
endcase
case STATE_MAIN
if things[this].vars[V_CROSSHAIR_HIDDEN] = 1 and things[T_WEAP].used = YES
SetSpriteVisible(things[this].vars[V_CROSSHAIR_SID], 1)
things[this].vars[V_CROSSHAIR_HIDDEN] = 0
endif
endcase
case STATE_HIDE
SetSpriteVisible(things[this].vars[V_CROSSHAIR_SID], 0)
things[this].vars[V_CROSSHAIR_HIDDEN] = 1
things[this].state = STATE_MAIN
endcase
endselect
endfunction
function ProgSmoke(tgame ref as Game, things ref as Thing[], this as integer)
select things[this].state
case STATE_INIT
rand as integer
initx as float
inity as float
initz as float
sizenow as float
initx = things[this].vars[V_SMOKE_INITX]
inity = things[this].vars[V_SMOKE_INITY]
initz = things[this].vars[V_SMOKE_INITZ]
if things[this].vars[V_SMOKE_SIZENOW] = 0 : things[this].vars[V_SMOKE_SIZENOW] = 0.4 : endif
sizenow = things[this].vars[V_SMOKE_SIZENOW]
things[this].vars[V_SMOKE_ALPHANOW] = 255
SetObjectScale(things[this].id, sizenow,sizenow,sizenow)
SetObjectImage(things[this].id, IMG_SMOKE, 0)
SetObjectVisible(things[this].id, 1)
SetObjectTransparency(things[this].id, 1)
SetObjectCollisionMode(things[this].id, 0)
SetObjectLightMode( things[this].id, 0 )
SetObjectPosition(things[this].id, initx,inity,initz)
SetObjectLookAt(things[this].id, GetCameraX(CAM_MAIN),GetCameraY(CAM_MAIN),GetCameraZ(CAM_MAIN),0)
MoveObjectLocalZ(things[this].id, 1)
things[this].vars[V_SMOKE_NEXTTIME] = tgame.ms + 2000
things[this].state = STATE_MAIN
endcase
case STATE_MAIN
color as integer
SetObjectLookAt(things[this].id, GetCameraX(CAM_MAIN),GetCameraY(CAM_MAIN),GetCameraZ(CAM_MAIN),0)
MoveObjectLocalY(things[this].id, 0.02)
inc things[this].vars[V_SMOKE_SIZENOW], 0.005
dec things[this].vars[V_SMOKE_ALPHANOW], 2
if things[this].vars[V_SMOKE_ALPHANOW] < 0
things[this].vars[V_SMOKE_ALPHANOW] = 0
things[this].state = STATE_DEAD
endif
if things[this].vars[V_SMOKE_ALPHANOW] <> 0
if things[this].vars[V_SMOKE_DARKER] = 1
color = 0
else
color = 255
endif
SetObjectColor(things[this].id, color,color,color,things[this].vars[V_SMOKE_ALPHANOW])
endif
SetObjectScale(things[this].id,things[this].vars[V_SMOKE_SIZENOW],things[this].vars[V_SMOKE_SIZENOW],things[this].vars[V_SMOKE_SIZENOW])
if tgame.ms > things[this].vars[V_SMOKE_NEXTTIME]
things[this].state = STATE_DEAD
endif
endcase
case STATE_DEAD
ClearThing(things,this)
endcase
endselect
endfunction
function ProgItem(tgame ref as Game, things ref as Thing[], this as integer)
select things[this].state
case STATE_INIT
uselight as integer
initx as integer
initz as integer
initx = things[this].vars[V_ITEM_INITX]
initz = things[this].vars[V_ITEM_INITZ]
If things[this].vars[V_ITEM_TYPE] = ITEM_YELKEY
SetObjectImage(things[this].id, IMG_GCOLORYELLOW, 0)
elseif things[this].vars[V_ITEM_TYPE] = ITEM_REDKEY
SetObjectImage(things[this].id, IMG_GCOLORRED, 0)
elseif things[this].vars[V_ITEM_TYPE] = ITEM_BLUKEY
SetObjectImage(things[this].id, IMG_GCOLORBLUE, 0)
elseif things[this].vars[V_ITEM_TYPE] = ITEM_COIN
SetObjectLightMode(things[this].id, 0)
elseif things[this].vars[V_ITEM_TYPE] = ITEM_GEM
SetObjectLightMode(things[this].id, 0)
SetObjectColorEmissive(things[this].id, 255,40,40)
endif
if things[this].vars[V_ITEM_TYPE] = ITEM_GEM
uselight = GetEmptyLight(LIGHTSTART,LIGHTEND)
if uselight <> -1
things[this].vars[V_ITEM_LIGHT] = uselight
CreatePointLight(uselight, initx, 2, initz, 5, 255,40,40)
SetPointLightMode(uselight, 1)
endif
endif
SetObjectPosition(things[this].id, initx, 0,initz)
things[this].state = STATE_MAIN
endcase
case STATE_MAIN
if things[this].vars[V_ITEM_TYPE] = ITEM_PISTOL or things[this].vars[V_ITEM_TYPE] = ITEM_RIFLE or things[this].vars[V_ITEM_TYPE] = ITEM_LAUNCHER or things[this].vars[V_ITEM_TYPE] = ITEM_COIN or things[this].vars[V_ITEM_TYPE] = ITEM_GEM or things[this].vars[V_ITEM_TYPE] = ITEM_YELKEY or things[this].vars[V_ITEM_TYPE] = ITEM_BLUKEY or things[this].vars[V_ITEM_TYPE] = ITEM_REDKEY
RotateObjectLocalY(things[this].id, 1.4)
endif
exitfunction
endcase
case STATE_DEAD
itemtype as integer
updatenum as integer
msgslot as integer
nopickup as integer
msgtextsize as integer
msgtextsize = 28
nopickup = 0
if things[T_PLAYER].used = YES and things[T_HUDHEALTH].used = YES and things[T_HUDCLIPCOUNTER].used = YES
itemtype = things[this].vars[V_ITEM_TYPE]
if itemtype = ITEM_PISTOL and things[T_INVENTORY].used = YES
if things[T_INVENTORY].vars[V_INVENTORY_HASGUN] = 1
itemtype = ITEM_AMMO
else
msgslot = 10
endif
things[T_INVENTORY].vars[V_INVENTORY_HASGUN] = 1
elseIf itemtype = ITEM_RIFLE and things[T_INVENTORY].used = YES
if things[T_INVENTORY].vars[V_INVENTORY_HASRIFLE] = 1
itemtype = ITEM_AMMO
else
msgslot = 9
endif
things[T_INVENTORY].vars[V_INVENTORY_HASRIFLE] = 1
elseIf itemtype = ITEM_LAUNCHER and things[T_INVENTORY].used = YES
if things[T_INVENTORY].vars[V_INVENTORY_HASRLAUNCHER] = 1
itemtype = ITEM_AMMO
else
msgslot = 11
endif
things[T_INVENTORY].vars[V_INVENTORY_HASRLAUNCHER] = 1
elseIf itemtype = ITEM_YELKEY and things[T_INVENTORY].used = YES
things[T_INVENTORY].vars[V_INVENTORY_HASYELKEY] = 1
msgslot = 4
elseIf itemtype = ITEM_REDKEY and things[T_INVENTORY].used = YES
things[T_INVENTORY].vars[V_INVENTORY_HASREDKEY] = 1
msgslot = 3
elseIf itemtype = ITEM_BLUKEY and things[T_INVENTORY].used = YES
things[T_INVENTORY].vars[V_INVENTORY_HASBLUKEY] = 1
msgslot = 5
elseIf itemtype = ITEM_HEALTH
if things[T_PLAYER].vars[V_PLAYER_HP] >= 99
if things[T_HUDMSG].used = NO
ShowMessage(things, 8, POS_TOPCENTER, 1500, msgtextsize) //show you don't need this message
endif
nopickup = 1
else
things[T_PLAYER].vars[V_PLAYER_HP] = things[T_PLAYER].vars[V_PLAYER_HP] + 50
if things[T_PLAYER].vars[V_PLAYER_HP] > 99
things[T_PLAYER].vars[V_PLAYER_HP] = 99
endif
things[T_HUDHEALTH].vars[V_COUNTER_NUMREC] = things[T_PLAYER].vars[V_PLAYER_HP]
things[T_HUDHEALTH].state = STATE_UPDATE2
msgslot = 2
endif
endif
if itemtype = ITEM_AMMO
if things[T_WEAP].used = YES
if things[T_WEAP].vars[V_WEAP_SPAREAMMO] = things[T_WEAP].vars[V_WEAP_SPAREAMMOMAX] or things[T_WEAP].state = STATE_RELOAD //DO NOT PICKUP WHEN FULL MELEE
nopickup = 1 //set to 1 keep this item alive
if things[T_HUDMSG].used = NO
ShowMessage(things, 8, POS_TOPCENTER, 1500, msgtextsize) //show you don't need this message
endif
else
if things[T_WEAP].vars[V_WEAP_ISROCKETLAUNCHER] = 1
inc things[T_WEAP].vars[V_WEAP_SPAREAMMO], 5
else
inc things[T_WEAP].vars[V_WEAP_SPAREAMMO], 50
endif
things[T_WEAP].state = STATE_RELOAD //force reload
endif
else
nopickup = 1
endif
msgslot = 1
endif
if itemtype = ITEM_COIN
if things[T_HUDCOINS].used = YES and things[T_HUDLIVES].used = YES and things[T_INVENTORY].used = YES
inc things[T_INVENTORY].vars[V_INVENTORY_COINS], 10
if things[T_INVENTORY].vars[V_INVENTORY_COINS] > 99
things[T_INVENTORY].vars[V_INVENTORY_COINS] = 0
inc tgame.lives
things[T_HUDLIVES].vars[V_COUNTER_NUMREC] = tgame.lives
things[T_HUDLIVES].state = STATE_UPDATE2
PlaySound(SND_1UP)
msgslot = 20
else
msgslot = 15
endif
things[T_HUDCOINS].vars[V_COUNTER_NUMREC] = things[T_INVENTORY].vars[V_INVENTORY_COINS]
things[T_HUDCOINS].state = STATE_UPDATE2
endif
endif
if itemtype = ITEM_GEM
if things[T_HUDGEMS].used = YES and things[T_INVENTORY].used = YES
inc things[T_INVENTORY].vars[V_INVENTORY_GEMS], 1
things[T_HUDGEMS].vars[V_COUNTER_NUMREC] = things[T_INVENTORY].vars[V_INVENTORY_GEMS]
things[T_HUDGEMS].state = STATE_UPDATE2
msgslot = 17
endif
endif
endif
//show msg on pickup
if nopickup = 0
ShowMessage(things, msgslot, POS_TOPCENTER, 1500, msgtextsize)
//do screen flash effect
If things[T_HUDDMG].used = YES
if itemtype = ITEM_HEALTH
things[T_HUDDMG].state = STATE_EFFECTGREEN
else
things[T_HUDDMG].state = STATE_EFFECTYELLOW
endif
endif
//delete this thing
if things[this].vars[V_ITEM_LIGHT] <> 0
DeletePointLight(things[this].vars[V_ITEM_LIGHT])
endif
//play sound
if itemtype = ITEM_GEM
PlaySound(SND_PICKUP2)
elseif itemtype = ITEM_HEALTH
PlaySound(SND_PICKUP1)
elseif itemtype = ITEM_COIN
PlaySound(SND_COIN)
elseif itemtype = ITEM_BLUKEY or itemtype = ITEM_YELKEY or itemtype = ITEM_REDKEY
PlaySound(SND_PICKUP1)
elseif itemtype = ITEM_PISTOL or itemtype = ITEM_RIFLE or itemtype = ITEM_LAUNCHER or itemtype = ITEM_AMMO
PlaySound(SND_AMMO)
endif
ClearThing(things, this)
else
//keep alive if it wasn't picked up
things[this].state = STATE_MAIN
endif
endcase
endselect
endfunction
function ProgDmgEffect(tgame ref as Game, things ref as Thing[], this as integer)
select things[this].state
case STATE_INIT
//create sprites
things[this].vars[V_HUDDMG_GREENID] = CreateSprite(IMG_GREEN)
things[this].vars[V_HUDDMG_REDID] = CreateSprite(IMG_RED)
things[this].vars[V_HUDDMG_YELID] = CreateSprite(IMG_YELLOW)
SetSpriteSize(things[this].vars[V_HUDDMG_REDID], tgame.window_width, tgame.window_height)
SetSpriteSize(things[this].vars[V_HUDDMG_GREENID], tgame.window_width, tgame.window_height)
SetSpriteSize(things[this].vars[V_HUDDMG_YELID], tgame.window_width, tgame.window_height)
things[this].vars[V_HUDDMG_ALPHANOW] = 0
SetSpriteColorAlpha(things[this].vars[V_HUDDMG_REDID], things[this].vars[V_HUDDMG_ALPHANOW])
SetSpriteColorAlpha(things[this].vars[V_HUDDMG_GREENID], things[this].vars[V_HUDDMG_ALPHANOW])
SetSpriteColorAlpha(things[this].vars[V_HUDDMG_YELID], things[this].vars[V_HUDDMG_ALPHANOW])
things[this].state = STATE_IDLE
endcase
case STATE_IDLE
exitfunction
endcase
case STATE_EFFECTDOWN
if things[this].vars[V_HUDDMG_ALPHANOW] <> 0
dec things[this].vars[V_HUDDMG_ALPHANOW],5
if things[this].vars[V_HUDDMG_ALPHANOW] < 0 : things[this].vars[V_HUDDMG_ALPHANOW] = 0 : endif
if things[this].vars[V_HUDDMG_COLORACTIVE] = 0
SetSpriteColorAlpha(things[this].vars[V_HUDDMG_REDID], things[this].vars[V_HUDDMG_ALPHANOW])
elseif things[this].vars[V_HUDDMG_COLORACTIVE] = 1
SetSpriteColorAlpha(things[this].vars[V_HUDDMG_GREENID], things[this].vars[V_HUDDMG_ALPHANOW])
elseif things[this].vars[V_HUDDMG_COLORACTIVE] = 2
SetSpriteColorAlpha(things[this].vars[V_HUDDMG_YELID], things[this].vars[V_HUDDMG_ALPHANOW])
endif
endif
endcase
case STATE_EFFECTRED
SetSpriteColorAlpha(things[this].vars[V_HUDDMG_REDID], 0)
SetSpriteColorAlpha(things[this].vars[V_HUDDMG_GREENID], 0)
SetSpriteColorAlpha(things[this].vars[V_HUDDMG_YELID], 0)
things[this].vars[V_HUDDMG_ALPHANOW] = 200
things[this].vars[V_HUDDMG_COLORACTIVE] = 0
SetSpriteColorAlpha(things[this].vars[V_HUDDMG_REDID], things[this].vars[V_HUDDMG_ALPHANOW])
things[this].state = STATE_EFFECTDOWN
endcase
case STATE_EFFECTGREEN
SetSpriteColorAlpha(things[this].vars[V_HUDDMG_REDID], 0)
SetSpriteColorAlpha(things[this].vars[V_HUDDMG_GREENID], 0)
SetSpriteColorAlpha(things[this].vars[V_HUDDMG_YELID], 0)
things[this].vars[V_HUDDMG_ALPHANOW] = 200
things[this].vars[V_HUDDMG_COLORACTIVE] = 1
SetSpriteColorAlpha(things[this].vars[V_HUDDMG_GREENID], things[this].vars[V_HUDDMG_ALPHANOW])
things[this].state = STATE_EFFECTDOWN
endcase
case STATE_EFFECTYELLOW
SetSpriteColorAlpha(things[this].vars[V_HUDDMG_REDID], 0)
SetSpriteColorAlpha(things[this].vars[V_HUDDMG_GREENID], 0)
SetSpriteColorAlpha(things[this].vars[V_HUDDMG_YELID], 0)
things[this].vars[V_HUDDMG_ALPHANOW] = 200
things[this].vars[V_HUDDMG_COLORACTIVE] = 2
SetSpriteColorAlpha(things[this].vars[V_HUDDMG_YELID], things[this].vars[V_HUDDMG_ALPHANOW])
things[this].state = STATE_EFFECTDOWN
endcase
case STATE_EFFECTREDSTAY
SetSpriteColorAlpha(things[this].vars[V_HUDDMG_REDID], 0)
SetSpriteColorAlpha(things[this].vars[V_HUDDMG_GREENID], 0)
SetSpriteColorAlpha(things[this].vars[V_HUDDMG_YELID], 0)
things[this].vars[V_HUDDMG_ALPHANOW] = 150
SetSpriteColorAlpha(things[this].vars[V_HUDDMG_REDID], things[this].vars[V_HUDDMG_ALPHANOW])
things[this].state = STATE_IDLE
endcase
endselect
endfunction
function ProgMsg(tgame ref as Game, things ref as Thing[], this as integer)
select things[this].state
case STATE_INIT
initpos as Coord2D
slot as integer
msg as string
textid as integer
slot = things[this].vars[V_MSG_SLOT]
if things[this].vars[V_MSG_TEXTSIZE] = 0 : things[this].vars[V_MSG_TEXTSIZE] = 32 : endif
if things[this].vars[V_MSG_SHOWTIME] = 0 : things[this].vars[V_MSG_SHOWTIME] = 1500 : endif
if slot = 0
msg = "YOU DIED"
elseif slot = 1
msg = "RECEIVED AMMO"
elseif slot = 2
msg = "GOT A MEDKIT"
elseif slot = 3
msg = "ACQUIRED RED KEY"
elseif slot = 4
msg = "ACQUIRED Y. KEY"
elseif slot = 5
msg = "ACQUIRED BLUE KEY"
elseif slot = 6
msg = "THIS DOOR IS LOCKED"
elseif slot = 7
msg = "YOU USED THE KEY"
elseif slot = 8
msg = "YOU DON'T NEED THIS YET"
elseif slot = 9
msg = "ACQUIRED THE ASSAULT RIFLE"
elseif slot = 10
msg = "ACQUIRED THE HANDGUN"
elseif slot = 11
msg = "ACQUIRED THE RPG"
elseif slot = 12
msg = "MAP WAS SAVED SUCCESSFULLY"
elseif slot = 13
msg = "MAP COULD NOT BE SAVED"
elseif slot = 14
msg = "LEVEL " + Str(tgame.currentslot)
elseif slot = 15
msg = "GOT A COIN"
elseif slot = 16
msg = "LEVEL COMPLETE!"
elseif slot = 17
msg = "FOUND A GEM"
elseif slot = 18
gemcount as integer
if things[T_EXIT].used = YES
gemcount = things[T_EXIT].vars[V_EXIT_GEMREQ]
endif
msg = "YOU NEED " + Str(gemcount) + " GEMS" +CHR(13)+CHR(10)+ "TO USE THIS GATE"
elseif slot = 19
msg = "THE GATE HAS BEEN ACTIVATED"
elseif slot = 20
msg = "GAINED AN EXTRA LIFE"
endif
things[this].vars[V_MSG_TEXTID] = CreateText(msg)
textid = things[this].vars[V_MSG_TEXTID]
SetTextFontImage(textid, IMG_MAINFONT)
SetTextSize(textid, things[this].vars[V_MSG_TEXTSIZE])
GetHudPos(tgame, GetTextTotalWidth(textid), GetTextTotalHeight(textid), things[this].vars[V_MSG_INITPOS], initpos)
SetTextPosition(textid, initpos.x, initpos.y)
things[this].vars[V_MSG_NEXTTIME] = tgame.ms + things[this].vars[V_MSG_SHOWTIME]
things[this].state = STATE_MAIN
endcase
case STATE_MAIN
if tgame.ms > things[this].vars[V_MSG_NEXTTIME]
things[this].state = STATE_DEAD
endif
endcase
case STATE_DEAD
DeleteText(things[this].vars[V_MSG_TEXTID])
ClearThing(things, this)
endcase
endselect
endfunction
function ProgCounter(tgame ref as Game, things ref as Thing[], this as integer)
select things[this].state
case STATE_INIT
initpos as Coord2D
numnowinit as integer
textid as integer
sprite as integer
useimg as integer
spritesize as integer
if things[this].vars[V_COUNTER_INITTEXTSIZE] = 0 : things[this].vars[V_COUNTER_INITTEXTSIZE] = 32 : endif
//setupsprite
useimg = things[this].vars[V_COUNTER_USEIMG]
if useimg = 0 then useimg = IMG_BRICK
things[this].vars[V_COUNTER_SPR] = CreateSprite(useimg)
sprite = things[this].vars[V_COUNTER_SPR]
things[this].vars[V_COUNTER_COUNTTEXTID] = CreateText(AddZeros(2,STR(numnowinit)))
textid = things[this].vars[V_COUNTER_COUNTTEXTID]
SetTextFontImage(textid, IMG_MAINFONT)
numnowinit = things[this].vars[V_COUNTER_NUMNOW]
SetTextSize(things[this].vars[V_COUNTER_COUNTTEXTID], things[this].vars[V_COUNTER_INITTEXTSIZE])
//resizesprite based on text
spritesize = GetTextTotalHeight(textid)
SetSpriteSize(sprite, spritesize, spritesize)
GetHudPos(tgame, GetTextTotalWidth(textid) + spritesize, GetTextTotalHeight(textid), things[this].vars[V_COUNTER_INITPOS], initpos)
SetTextPosition(things[this].vars[V_COUNTER_COUNTTEXTID], initpos.x + spritesize, initpos.y)
SetTextString(things[this].vars[V_COUNTER_COUNTTEXTID], AddZeros(2,STR(numnowinit)))
SetTextVisible(things[this].vars[V_COUNTER_COUNTTEXTID], 1)
SetSpritePosition(sprite, initpos.x, initpos.y)
things[this].state = STATE_IDLE
endcase
case STATE_IDLE
endcase
case STATE_UPDATE
numnow as integer
numrec as integer
numnow = things[this].vars[V_COUNTER_NUMNOW]
numrec = things[this].vars[V_COUNTER_NUMREC]
numnow = numnow + numrec
things[this].vars[V_COUNTER_NUMNOW] = numnow
things[this].vars[V_COUNTER_NUMREC] = 0
SetTextString(things[this].vars[V_COUNTER_COUNTTEXTID],AddZeros(2,STR(numnow)))
SetTextVisible(things[this].vars[V_COUNTER_COUNTTEXTID], 1)
things[this].state = STATE_IDLE
endcase
case STATE_UPDATE2
tmpnum as integer
things[this].vars[V_COUNTER_NUMNOW] = things[this].vars[V_COUNTER_NUMREC]
things[this].vars[V_COUNTER_NUMREC] = 0
tmpnum = things[this].vars[V_COUNTER_NUMNOW]
SetTextString(things[this].vars[V_COUNTER_COUNTTEXTID], AddZeros(2,STR(tmpnum)))
SetTextVisible(things[this].vars[V_COUNTER_COUNTTEXTID], 1)
things[this].state = STATE_IDLE
endcase
case STATE_HIDE
SetTextVisible(things[this].vars[V_COUNTER_COUNTTEXTID], 0)
things[this].state = STATE_IDLE
endcase
case STATE_SHOW
SetTextVisible(things[this].vars[V_COUNTER_COUNTTEXTID], 0)
things[this].state = STATE_IDLE
endcase
endselect
endfunction
function ProgBurst(tgame ref as Game, things ref as Thing[], this as integer)
x as float : y as float : z as float
xrot as float : yrot as float : zrot as float
select things[this].state
case STATE_INIT
//setup
SetObjectCollisionMode(things[this].id, 0)
SetObjectColorEmissive(things[this].id, 50,50,50)
SetObjectLightMode(things[this].id, 0)
SetObjectTransparency(things[this].id, 1)
SetObjectDepthRange( things[this].id, 0.06, 0.1)
SetObjectVisible(things[this].id, 0)
//things[this].vars[V_BURST_OFFSETX] = 0.1
//things[this].vars[V_BURST_OFFSETY] = -0.1
//things[this].vars[V_BURST_OFFSETZ] = 1
//follow camera
x = GetCameraX(CAM_MAIN)
y = GetcameraY(CAM_MAIN)
z = GetCameraZ(CAM_MAIN)
xrot = GetCameraAngleX(CAM_MAIN)
yrot = GetCameraAngleY(CAM_MAIN)
zrot = GetCameraAngleZ(CAM_MAIN)
SetObjectPosition(things[this].id, x, y, z)
SetObjectRotation(things[this].id, xrot, yrot, zrot)
MoveObjectLocalX(things[this].id, things[this].vars[V_BURST_OFFSETX])
MoveObjectLocalY(things[this].id, things[this].vars[V_BURST_OFFSETY])
MoveObjectLocalZ(things[this].id, things[this].vars[V_BURST_OFFSETZ])
things[this].state = STATE_NOBURST
endcase
case STATE_BURSTSTART
things[this].vars[V_BURST_NEXTTIME] = tgame.ms + 50
things[this].state = STATE_BURST
endcase
case STATE_BURST
if GetObjectVisible(things[this].id) = 0 : SetObjectVisible(things[this].id, 1) : endif
x = GetCameraX(CAM_MAIN)
y = GetcameraY(CAM_MAIN)
z = GetCameraZ(CAM_MAIN)
xrot = GetCameraAngleX(CAM_MAIN)
yrot = GetCameraAngleY(CAM_MAIN)
zrot = GetCameraAngleZ(CAM_MAIN)
SetObjectPosition(things[this].id, x, y, z)
SetObjectRotation(things[this].id, xrot, yrot, zrot)
MoveObjectLocalX(things[this].id, things[this].vars[V_BURST_OFFSETX])
MoveObjectLocalY(things[this].id, things[this].vars[V_BURST_OFFSETY])
MoveObjectLocalZ(things[this].id, things[this].vars[V_BURST_OFFSETZ])
RotateObjectLocalZ(things[this].id, random(0,360))
If GetPointLightExists(LIGHT_BURST) = 0
CreatePointLight(LIGHT_BURST, GetObjectX(things[this].id),GetObjectY(things[this].id),GetObjectZ(things[this].id), 15, 255,255,128)
SetPointLightMode(LIGHT_BURST, 1)
endif
if tgame.ms > things[this].vars[V_BURST_NEXTTIME]
things[this].state = STATE_NOBURST
endif
endcase
case STATE_NOBURST
If GetPointLightExists(LIGHT_BURST) = 1
DeletePointLight(LIGHT_BURST)
endif
if GetObjectVisible(things[this].id) = 1 : SetObjectVisible(things[this].id, 0) : endif
endcase
endselect
endfunction
function PlaceObject(tgame ref as Game, tmpnum as integer, x as float, z as float)
objid as integer
useslot as integer
rotate as integer
colorlight as integer
if tmpnum > TMPL_LAST
rotate = 1
tmpnum = tmpnum - TMPL_LAST
endif
select tmpnum
case TMPL_LAST
objid = CloneTObject(tgame, tmpnum)
SetObjectPosition(objid, x, 0, z)
endcase
case TMPL_WCSTARTNORTH
objid = CloneTObject(tgame, tmpnum)
SetObjectPosition(objid, x, 0, z)
if rotate = 1 then RotateObjectLocalY(objid, 90)
endcase
case TMPL_WCSTARTSOUTH
objid = CloneTObject(tgame, tmpnum)
SetObjectPosition(objid, x, 0, z)
if rotate = 1 then RotateObjectLocalY(objid, 90)
endcase
case TMPL_WALL
objid = CloneTObject(tgame, tmpnum)
SetObjectPosition(objid, x, 0, z)
if rotate = 1 then RotateObjectLocalY(objid, 90)
endcase
case TMPL_TWALLNORTH
objid = CloneTObject(tgame, tmpnum)
SetObjectPosition(objid, x, 0, z)
if rotate = 1 then RotateObjectLocalY(objid, 90)
endcase
case TMPL_TWALLSOUTH
objid = CloneTObject(tgame, tmpnum)
SetObjectPosition(objid, x, 0, z)
if rotate = 1 then RotateObjectLocalY(objid, 90)
endcase
case TMPL_FBARREL3
objid = CloneTObject(tgame, tmpnum)
SetObjectPosition(objid, x, 0, z)
if rotate = 1 then RotateObjectLocalY(objid, 90)
endcase
case TMPL_WALLCORNER
objid = CloneTObject(tgame, tmpnum)
SetObjectPosition(objid, x, 0, z)
endcase
case TMPL_WALLDOORFRAME
objid = CloneTObject(tgame, tmpnum)
SetObjectPosition(objid, x, 0, z)
if rotate = 1 then RotateObjectLocalY(objid, 90)
endcase
case TMPL_GRASS
objid = CloneTObject(tgame, tmpnum)
SetObjectPosition(objid, x, 0, z)
endcase
case TMPL_MEPLAYER
SetObjectPosition(things[T_PLAYER].id, x, 2, z)
endcase
case TMPL_ITEMPISTOL
useslot = GetEmptySlot(things, T_ITEMSSTART, T_ITEMEND)
if useslot <> -1
SpawnThing(things, useslot, CloneTObject(tgame,TMPL_ITEMPISTOL), PROG_ITEM, THING_TYPE_OBJ)
SETV(things, useslot, V_ITEM_INITX, x)
SETV(things, useslot, V_ITEM_INITZ, z)
SETV(things, useslot, V_ITEM_TYPE, ITEM_PISTOL)
endif
endcase
case TMPL_ITEMRIFLE
useslot = GetEmptySlot(things, T_ITEMSSTART, T_ITEMEND)
if useslot <> -1
SpawnThing(things, useslot, CloneTObject(tgame,TMPL_ITEMRIFLE), PROG_ITEM, THING_TYPE_OBJ)
SETV(things, useslot, V_ITEM_INITX, x)
SETV(things, useslot, V_ITEM_INITZ, z)
SETV(things, useslot, V_ITEM_TYPE, ITEM_RIFLE)
endif
endcase
case TMPL_ITEMLAUNCHER
useslot = GetEmptySlot(things, T_ITEMSSTART, T_ITEMEND)
if useslot <> -1
SpawnThing(things, useslot, CloneTObject(tgame,TMPL_ITEMLAUNCHER), PROG_ITEM, THING_TYPE_OBJ)
SETV(things, useslot, V_ITEM_INITX, x)
SETV(things, useslot, V_ITEM_INITZ, z)
SETV(things, useslot, V_ITEM_TYPE, ITEM_LAUNCHER)
endif
endcase
case TMPL_GOLEM
useslot = GetEmptySlot(things, T_ENEMYSTART, T_ENEMYEND)
if useslot <> -1
SpawnThing(things, useslot, CreateObjectBox(5,4,3), PROG_ENEMY, THING_TYPE_OBJ)
SETV(things, useslot, V_ENEMY_INITX, x)
SETV(things, useslot, V_ENEMY_INITZ, z)
SETV(things, useslot, V_ENEMY_USETEMPLATE, TMPL_GOLEM)
SETV(things, useslot, V_ENEMY_ANIM_IDLE_B, ANIM_GOLEMIDLE_B)
SETV(things, useslot, V_ENEMY_ANIM_IDLE_E, ANIM_GOLEMIDLE_E)
SETV(things, useslot, V_ENEMY_ANIM_IDLE_T, ANIM_GOLEMIDLE_T)
SETV(things, useslot, V_ENEMY_ANIM_DIE_B, ANIM_GOLEMDIE_B)
SETV(things, useslot, V_ENEMY_ANIM_DIE_E, ANIM_GOLEMDIE_E)
SETV(things, useslot, V_ENEMY_ANIM_DIE_T, ANIM_GOLEMDIE_T)
SETV(things, useslot, V_ENEMY_ANIM_MOVE_B, ANIM_GOLEMWALK_B)
SETV(things, useslot, V_ENEMY_ANIM_MOVE_E, ANIM_GOLEMWALK_E)
SETV(things, useslot, V_ENEMY_ANIM_MOVE_T, ANIM_GOLEMWALK_T)
SETV(things, useslot, V_ENEMY_ANIM_ATTACK_B, ANIM_GOLEMATTACK_B)
SETV(things, useslot, V_ENEMY_ANIM_ATTACK_E, ANIM_GOLEMATTACK_E)
SETV(things, useslot, V_ENEMY_ANIM_ATTACK_T, ANIM_GOLEMATTACK_T)
SETV(things, useslot, V_ENEMY_PROJECTILEDIST, 300)
SETV(things, useslot, V_ENEMY_RANGE, 100)
SETV(things, useslot, V_ENEMY_ATTACKRANGE, 80)
SETV(things, useslot, V_ENEMY_SPEED, 0.05)
SETV(things, useslot, V_ENEMY_ATTACKWAIT, 1000)
SETV(things, useslot, V_ENEMY_TMPLFORBULLET, TMPL_BOULDER)
SETV(things, useslot, V_ENEMY_USEROCKET, 1)
SETV(things, useslot, V_ENEMY_HP, 300)
SETV(things, useslot, V_ENEMY_HITBOXFLOAT, 7)
SETV(things, useslot, V_ENEMY_PROJECTILESPREAD, 0)
SETV(things, useslot, V_ENEMY_PROJECTILESCASTSIZE, 2)
SETV(things, useslot, V_ENEMY_PROJECTILEUP, 3)
endif
endcase
case TMPL_SKELETON
useslot = GetEmptySlot(things, T_ENEMYSTART, T_ENEMYEND)
if useslot <> -1
SpawnThing(things, useslot, CreateObjectBox(0.5,2,1), PROG_ENEMY, THING_TYPE_OBJ)
SETV(things, useslot, V_ENEMY_INITX, x)
SETV(things, useslot, V_ENEMY_INITZ, z)
SETV(things, useslot, V_ENEMY_USETEMPLATE, TMPL_SKELETON)
SETV(things, useslot, V_ENEMY_ANIM_IDLE_B, ANIM_SKELIDLE_B)
SETV(things, useslot, V_ENEMY_ANIM_IDLE_E, ANIM_SKELIDLE_E)
SETV(things, useslot, V_ENEMY_ANIM_IDLE_T, ANIM_SKELIDLE_T)
SETV(things, useslot, V_ENEMY_ANIM_DIE_B, ANIM_SKELDIE_B)
SETV(things, useslot, V_ENEMY_ANIM_DIE_E, ANIM_SKELDIE_E)
SETV(things, useslot, V_ENEMY_ANIM_DIE_T, ANIM_SKELDIE_T)
SETV(things, useslot, V_ENEMY_ANIM_MOVE_B, ANIM_SKELWALK_B)
SETV(things, useslot, V_ENEMY_ANIM_MOVE_E, ANIM_SKELWALK_E)
SETV(things, useslot, V_ENEMY_ANIM_MOVE_T, ANIM_SKELWALK_T)
SETV(things, useslot, V_ENEMY_ANIM_ATTACK_B, ANIM_SKELATTACK_B)
SETV(things, useslot, V_ENEMY_ANIM_ATTACK_E, ANIM_SKELATTACK_E)
SETV(things, useslot, V_ENEMY_ANIM_ATTACK_T, ANIM_SKELATTACK_T)
SETV(things, useslot, V_ENEMY_PROJECTILEDIST, 10)
SETV(things, useslot, V_ENEMY_RANGE, 100)
SETV(things, useslot, V_ENEMY_ATTACKRANGE, 7)
SETV(things, useslot, V_ENEMY_SPEED, 0.3)
SETV(things, useslot, V_ENEMY_ATTACKWAIT, 1000)
SETV(things, useslot, V_ENEMY_HITBOXFLOAT, 2.5)
SETV(things, useslot, V_ENEMY_PROJECTILEUP, 1)
SETV(things, useslot, V_ENEMY_FORWARDTIME, 400)
SETV(things, useslot, V_ENEMY_SNDALERT, SND_SCREECH1)
SETV(things, useslot, V_ENEMY_SNDATTACK, SND_SWING2)
SETV(things, useslot, V_ENEMY_SNDDIE, SND_FALL2)
SETV(things, useslot, V_ENEMY_SNDFORWARD, SND_SCREECH2)
endif
endcase
case TMPL_SKELSOLDIER
useslot = GetEmptySlot(things, T_ENEMYSTART, T_ENEMYEND)
if useslot <> -1
SpawnThing(things, useslot, CreateObjectBox(1,2,1), PROG_ENEMY, THING_TYPE_OBJ)
SETV(things, useslot, V_ENEMY_INITX, x)
SETV(things, useslot, V_ENEMY_INITZ, z)
SETV(things, useslot, V_ENEMY_USETEMPLATE, TMPL_SKELSOLDIER)
SETV(things, useslot, V_ENEMY_ANIM_IDLE_B, ANIM_SKELIDLE_B)
SETV(things, useslot, V_ENEMY_ANIM_IDLE_E, ANIM_SKELIDLE_E)
SETV(things, useslot, V_ENEMY_ANIM_IDLE_T, ANIM_SKELIDLE_T)
SETV(things, useslot, V_ENEMY_ANIM_DIE_B, ANIM_SKELDIE_B)
SETV(things, useslot, V_ENEMY_ANIM_DIE_E, ANIM_SKELDIE_E)
SETV(things, useslot, V_ENEMY_ANIM_DIE_T, ANIM_SKELDIE_T)
SETV(things, useslot, V_ENEMY_ANIM_MOVE_B, ANIM_SKELWALK_B)
SETV(things, useslot, V_ENEMY_ANIM_MOVE_E, ANIM_SKELWALK_E)