Changeset 3927 for data/branches/single_player_map/scripts
- Timestamp:
- Jun 28, 2006, 6:45:50 PM (18 years ago)
- Location:
- data/branches/single_player_map/scripts
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
data/branches/single_player_map/scripts/falldown.lua
r3921 r3927 1 1 2 randTime = 0 3 eventFinished = false 4 randinit = false 5 6 function RandTime() 7 8 if not randinit then 9 math.randomseed(os.clock()) 10 randinit = true 11 randTime = 5 * math.random() 12 end 13 end 14 15 16 function fallDown(timestep) 17 18 eventFinished = true 19 end 20 21 22 function tick(timestep) 23 io.write("Falldown called \n") 24 RandTime() 25 26 if randTime > 0 then 27 randTime = randTime - timestep 28 else 29 fallDown(timestep) 30 end 31 32 return eventFinished 33 34 end -
data/branches/single_player_map/scripts/lua_extra_functions
r3921 r3927 1 1 !--------------- Copy this to the beginning of a lua script to use the functions ---------------! 2 2 3 3 -- Initialises the random number generator 4 randinit = false 4 5 function randInit() 5 6 … … 10 11 11 12 end 13 14 15 -- Returns the distance between (x1,x2,x3) and (y1,y2,y3) 16 function dist( x1,x2,x3, y1,y2,y3 ) 17 18 return math.sqrt( (x1-y1)^2 + (x2-y2)^2 + (x3-y3)^2 ) 19 20 end -
data/branches/single_player_map/scripts/thestranger.lua
r3921 r3927 2 2 panic = false -- True if thestranger panics. 3 3 walkingRouteOne = false -- True if thestranger is walking route one 4 randinit = false5 6 function randInit()7 8 if not randinit then9 math.randomseed(os.clock())10 randinit = true11 end12 13 end14 4 15 5 … … 33 23 function tick(timestep) 34 24 35 randInit()36 37 randNum = math.random()38 io.write("random number is ", randNum, "\n")39 40 25 if not walkingRouteOne then 41 26 walkRouteOne()
Note: See TracChangeset
for help on using the changeset viewer.