1 | -- Get objects from orxonox |
---|
2 | thisscript:addObject("TestEntity", "fallingguy") |
---|
3 | thisscript:addObject("FPSPlayer", "Player") |
---|
4 | thisscript:addObject("GenericNPC","fleemechanic") |
---|
5 | |
---|
6 | dy = 0 |
---|
7 | randTime = 0 |
---|
8 | eventFinished = false |
---|
9 | randinit = false |
---|
10 | mtheight = -10 |
---|
11 | |
---|
12 | function RandTime() |
---|
13 | |
---|
14 | if not randinit then |
---|
15 | math.randomseed(os.clock()) |
---|
16 | randinit = true |
---|
17 | randTime = 8 * math.random() |
---|
18 | end |
---|
19 | end |
---|
20 | |
---|
21 | |
---|
22 | function fallDown(timestep) |
---|
23 | dy = dy + timestep |
---|
24 | thisX = fallingguy:getAbsCoorX() |
---|
25 | thisY = fallingguy:getAbsCoorY() |
---|
26 | thisZ = fallingguy:getAbsCoorZ() |
---|
27 | |
---|
28 | fallingguy:setAbsCoor(thisX, thisY - dy, thisZ) |
---|
29 | |
---|
30 | if thisY < -100 then |
---|
31 | eventFinished = true |
---|
32 | end |
---|
33 | |
---|
34 | end |
---|
35 | |
---|
36 | |
---|
37 | |
---|
38 | fleeprogrammed = false |
---|
39 | function flee(timestep) |
---|
40 | if not fleeprogrammed then |
---|
41 | fleemechanic:runTo( 735.658142, mtheight, -1525.291870) |
---|
42 | fleemechanic:runTo( 746.021912, mtheight, -1416.895508) |
---|
43 | fleemechanic:runTo( 746.021912, mtheight, -1415.689819) |
---|
44 | fleemechanic:runTo( 745.840454, mtheight, -1314.824585) |
---|
45 | fleemechanic:runTo( 745.840454, mtheight, -1313.533691) |
---|
46 | fleemechanic:runTo( 745.840454, mtheight, -1312.239258) |
---|
47 | fleemechanic:runTo( 745.840454, mtheight, -1310.942749) |
---|
48 | fleemechanic:runTo( 686.141907, mtheight, -1174.515015) |
---|
49 | fleemechanic:runTo( 685.479614, mtheight, -1173.372925) |
---|
50 | fleemechanic:runTo( 684.815857, mtheight, -1172.228271) |
---|
51 | fleemechanic:runTo( 630.430725, mtheight, -1072.972168) |
---|
52 | fleemechanic:runTo( 629.804199, mtheight, -1071.821777) |
---|
53 | fleemechanic:runTo( 629.174438, mtheight, -1070.665527) |
---|
54 | fleemechanic:runTo( 628.542786, mtheight, -1069.505859) |
---|
55 | fleemechanic:runTo( 627.905334, mtheight, -1068.335449) |
---|
56 | fleemechanic:runTo( 582.125610, mtheight, -969.282288) |
---|
57 | fleemechanic:runTo( 581.719971, mtheight, -968.030273) |
---|
58 | fleemechanic:runTo( 581.312866, mtheight, -966.773621) |
---|
59 | fleemechanic:runTo( 580.904602, mtheight, -965.513550) |
---|
60 | fleemechanic:runTo( 580.492493, mtheight, -964.241638) |
---|
61 | fleemechanic:runTo( 555.827942, mtheight, -873.071045) |
---|
62 | fleemechanic:runTo( 555.657410, mtheight, -871.761780) |
---|
63 | fleemechanic:runTo( 555.485962, mtheight, -870.445679) |
---|
64 | fleemechanic:runTo( 555.314087, mtheight, -869.126160) |
---|
65 | fleemechanic:runTo( 555.141418, mtheight, -867.800598) |
---|
66 | fleemechanic:runTo( 554.968262, mtheight, -866.471069) |
---|
67 | fleemechanic:runTo( 554.794922, mtheight, -865.140076) |
---|
68 | fleemechanic:runTo( 547.754639, mtheight, -767.221680) |
---|
69 | fleemechanic:runTo( 547.722961, mtheight, -765.892944) |
---|
70 | fleemechanic:runTo( 547.691223, mtheight, -764.562683) |
---|
71 | fleemechanic:runTo( 547.659180, mtheight, -763.219604) |
---|
72 | fleemechanic:runTo( 548.969849, mtheight, -649.171387) |
---|
73 | fleemechanic:runTo( 549.043274, mtheight, -647.850952) |
---|
74 | fleemechanic:runTo( 549.117126, mtheight, -646.523193) |
---|
75 | fleemechanic:runTo( 549.191101, mtheight, -645.193542) |
---|
76 | fleemechanic:runTo( 549.265137, mtheight, -643.862305) |
---|
77 | fleemechanic:runTo( 568.188416, mtheight, -510.499756) |
---|
78 | fleemechanic:runTo( 568.575439, mtheight, -509.219055) |
---|
79 | fleemechanic:runTo( 568.964539, mtheight, -507.931458) |
---|
80 | fleemechanic:runTo( 569.355469, mtheight, -506.637726) |
---|
81 | fleemechanic:runTo( 626.359924, mtheight, -384.633179) |
---|
82 | fleemechanic:runTo( 627.059998, mtheight, -383.511444) |
---|
83 | fleemechanic:runTo( 627.764282, mtheight, -382.382935) |
---|
84 | fleemechanic:runTo( 628.469055, mtheight, -381.253601) |
---|
85 | fleemechanic:runTo( 629.178345, mtheight, -380.117065) |
---|
86 | fleemechanic:runTo( 629.888367, mtheight, -378.979340) |
---|
87 | fleemechanic:runTo( 630.599548, mtheight, -377.839752) |
---|
88 | fleemechanic:runTo( 631.316711, mtheight, -376.690643) |
---|
89 | fleemechanic:runTo( 704.250305, mtheight, -250.679443) |
---|
90 | fleemechanic:runTo( 704.842896, mtheight, -249.538712) |
---|
91 | fleemechanic:runTo( 705.438721, mtheight, -248.391754) |
---|
92 | fleemechanic:runTo( 706.033630, mtheight, -247.246506) |
---|
93 | fleemechanic:runTo( 706.628479, mtheight, -246.101395) |
---|
94 | fleemechanic:runTo( 707.229248, mtheight, -244.944870) |
---|
95 | fleemechanic:runTo( 707.831665, mtheight, -243.785248) |
---|
96 | fleeprogrammed = true |
---|
97 | |
---|
98 | end |
---|
99 | end |
---|
100 | |
---|
101 | |
---|
102 | function tick(timestep) |
---|
103 | flee(timestep) |
---|
104 | --RandTime() |
---|
105 | |
---|
106 | --if randTime > 0 then |
---|
107 | --randTime = randTime - timestep |
---|
108 | --else |
---|
109 | fallDown(timestep) |
---|
110 | --end |
---|
111 | |
---|
112 | return eventFinished |
---|
113 | |
---|
114 | end |
---|