Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/script_engine/scripts/opendoor.lua @ 4070

Last change on this file since 4070 was 3878, checked in by snellen, 19 years ago

added opendoor.lua

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