Changeset 4328 for data/trunk/scripts
- Timestamp:
- Dec 14, 2006, 9:18:51 PM (18 years ago)
- Location:
- data/trunk/scripts
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
data/trunk/scripts/spaceship_flight.lua
r4217 r4328 20 20 21 21 function dist( x1,x2,x3, y1,y2,y3 ) 22 return math.sqrt( (x1-y1)^2 + (x2-y2)^2 + (x3-y3)^2 )22 return math.sqrt( (x1-y1)^2 + (x2-y2)^2 + (x3-y3)^2 ) 23 23 end 24 24 25 25 26 26 function observeSpaceCraft() 27 SPACE_CRAFTX = SPACE_CRAFT:getAbsCoorX()28 SPACE_CRAFTY = SPACE_CRAFT:getAbsCoorY()29 SPACE_CRAFTZ = SPACE_CRAFT:getAbsCoorZ()27 SPACE_CRAFTX = SPACE_CRAFT:getAbsCoorX() 28 SPACE_CRAFTY = SPACE_CRAFT:getAbsCoorY() 29 SPACE_CRAFTZ = SPACE_CRAFT:getAbsCoorZ() 30 30 31 distance = dist(SPACE_CRAFTX,SPACE_CRAFTY,SPACE_CRAFTZ,6053.186035, -2.306574, -1704.989624)31 distance = dist(SPACE_CRAFTX,SPACE_CRAFTY,SPACE_CRAFTZ,6053.186035, -2.306574, -1704.989624) 32 32 33 if distance < 100 then34 Hypergate:destroy()35 end33 if distance < 100 then 34 Hypergate:destroy() 35 end 36 36 37 37 end 38 38 39 39 function tick(timestep) 40 observeSpaceCraft()40 observeSpaceCraft() 41 41 42 if not horizontalmode then43 Ambush_at_Uranus:setPlaymode("Horizontal")44 Ambush_at_Uranus:setSoundtrack("sound/music/00-luke_grey_-_hypermode.ogg")45 SPACE_CRAFT:setAirFriction(3.0)46 horizontalmode = true47 end42 if not horizontalmode then 43 Ambush_at_Uranus:setPlaymode("Horizontal") 44 Ambush_at_Uranus:setSoundtrack("sound/music/00-luke_grey_-_hypermode.ogg") 45 SPACE_CRAFT:setAirFriction(3.0) 46 horizontalmode = true 47 end 48 48 49 if not terrancriuseratgate then50 dx = 70 * timestep51 dy = 0 * timestep52 dz = 0 * timestep49 if not terrancriuseratgate then 50 dx = 70 * timestep 51 dy = 0 * timestep 52 dz = 0 * timestep 53 53 54 TerranCruizerX = TerranCruizer:getAbsCoorX()55 TerranCruizerY = TerranCruizer:getAbsCoorY()56 TerranCruizerZ = TerranCruizer:getAbsCoorZ()54 TerranCruizerX = TerranCruizer:getAbsCoorX() 55 TerranCruizerY = TerranCruizer:getAbsCoorY() 56 TerranCruizerZ = TerranCruizer:getAbsCoorZ() 57 57 58 distance = dist(TerranCruizerX,TerranCruizerY,TerranCruizerZ,6053.186035, -2.306574, -1704.989624)58 distance = dist(TerranCruizerX,TerranCruizerY,TerranCruizerZ,6053.186035, -2.306574, -1704.989624) 59 59 60 if distance < 100 then61 TerranCruizer:hide()62 dx = 500063 terrancriuseratgate = true64 end60 if distance < 100 then 61 TerranCruizer:hide() 62 dx = 5000 63 terrancriuseratgate = true 64 end 65 65 66 TerranCruizer:setAbsCoor(TerranCruizerX + dx, TerranCruizerY + dy, TerranCruizerZ + dz)66 TerranCruizer:setAbsCoor(TerranCruizerX + dx, TerranCruizerY + dy, TerranCruizerZ + dz) 67 67 68 end68 end 69 69 70 70 return false
Note: See TracChangeset
for help on using the changeset viewer.