Line | |
---|
1 | -- A simple script for opening doors |
---|
2 | |
---|
3 | function tick(timestep) |
---|
4 | |
---|
5 | playerX = Player:getAbsCoorX() |
---|
6 | playerY = Player:getAbsCoorY() |
---|
7 | playerZ = Player:getAbsCoorZ() |
---|
8 | |
---|
9 | doorTriggerX = DoorTrigger:getAbsCoorX() |
---|
10 | doorTriggerY = DoorTrigger:getAbsCoorY() |
---|
11 | doorTriggerZ = DoorTrigger:getAbsCoorZ() |
---|
12 | |
---|
13 | |
---|
14 | radius = (playerX - doorTriggerX)^2 + (playerY - doorTriggerY)^2 +(playerZ - doorTriggerZ)^2 |
---|
15 | |
---|
16 | if radius < 10 then |
---|
17 | door:open(true) |
---|
18 | else |
---|
19 | door:open(false) |
---|
20 | end |
---|
21 | |
---|
22 | return false |
---|
23 | |
---|
24 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.