| Line |   | 
|---|
| 1 | -- Get objects from orxonox | 
|---|
| 2 | thisscript:addObject("FogEffect", "fog") | 
|---|
| 3 | thisscript:addObject("RainEffect", "rain") | 
|---|
| 4 | thisscript:addObject("SnowEffect", "snow") | 
|---|
| 5 | thisscript:addObject("LightningEffect", "lightning") | 
|---|
| 6 | thisscript:addObject("CloudEffect", "cloud") | 
|---|
| 7 |  | 
|---|
| 8 | thisscript:addObject("Hover", "Player") | 
|---|
| 9 |  | 
|---|
| 10 | -- Global Variables | 
|---|
| 11 | fogActivated = false | 
|---|
| 12 | rainActivated = false | 
|---|
| 13 | snowActivated = false | 
|---|
| 14 | lightningActivated = false | 
|---|
| 15 | cloudActivated = false | 
|---|
| 16 |  | 
|---|
| 17 | function tick(timestep) | 
|---|
| 18 |  | 
|---|
| 19 | playerX = Player:getAbsCoorX() | 
|---|
| 20 | playerY = Player:getAbsCoorY() | 
|---|
| 21 | playerZ = Player:getAbsCoorZ() | 
|---|
| 22 |  | 
|---|
| 23 |  | 
|---|
| 24 | if playerX > -1200 and not cloudActivated then | 
|---|
| 25 |   cloud:activate() | 
|---|
| 26 |   cloudActivated = true; | 
|---|
| 27 | end | 
|---|
| 28 |  | 
|---|
| 29 | if playerX > -900 and not fogActivated then | 
|---|
| 30 |  fog:activate() | 
|---|
| 31 |  fogActivated = true | 
|---|
| 32 | end | 
|---|
| 33 |  | 
|---|
| 34 | if playerX > -800 and not snowActivated then | 
|---|
| 35 |  snow:activate() | 
|---|
| 36 |  snowActivated = true | 
|---|
| 37 | end | 
|---|
| 38 |  | 
|---|
| 39 | if playerX > -700 and snowActivated then | 
|---|
| 40 |  snow:deactivate() | 
|---|
| 41 |  fog:deactivate() | 
|---|
| 42 | end | 
|---|
| 43 |  | 
|---|
| 44 | if playerX > -600 and not rainActivated then | 
|---|
| 45 |   rain:startRaining() | 
|---|
| 46 |   rainActivated = true | 
|---|
| 47 | end | 
|---|
| 48 |  | 
|---|
| 49 | if playerX > -500 and rainActivated and not lightningActivated then | 
|---|
| 50 |  lightning:activate() | 
|---|
| 51 |  lightningActivated = true | 
|---|
| 52 | end | 
|---|
| 53 |  | 
|---|
| 54 | if playerX > -300 and rainActivated then | 
|---|
| 55 |   rain:stopRaining() | 
|---|
| 56 |   lightning:deactivate() | 
|---|
| 57 | end | 
|---|
| 58 |  | 
|---|
| 59 | return false | 
|---|
| 60 | --return true | 
|---|
| 61 | end | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.