Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 28, 2006, 6:45:50 PM (18 years ago)
Author:
snellen
Message:

falldown.lua implemented

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
     2randTime = 0
     3eventFinished = false
     4randinit = false
     5
     6function RandTime()
     7
     8if not randinit then
     9math.randomseed(os.clock())
     10randinit = true
     11randTime = 5 * math.random()
     12end
     13end
     14
     15
     16function fallDown(timestep)
     17
     18eventFinished = true
     19end
     20
     21
     22function tick(timestep)
     23io.write("Falldown called \n")
     24RandTime()
     25
     26if randTime > 0 then
     27randTime = randTime - timestep
     28else
     29fallDown(timestep)
     30end
     31
     32return eventFinished
     33
     34end
  • data/branches/single_player_map/scripts/lua_extra_functions

    r3921 r3927  
    11!--------------- Copy this to the beginning of a lua script to use the functions ---------------!
    22
    3 
     3-- Initialises the random number generator
     4randinit = false
    45function randInit()
    56
     
    1011
    1112end
     13
     14
     15-- Returns the distance between (x1,x2,x3) and (y1,y2,y3)
     16function dist( x1,x2,x3, y1,y2,y3 )
     17
     18return math.sqrt( (x1-y1)^2 + (x2-y2)^2 + (x3-y3)^2 )
     19
     20end
  • data/branches/single_player_map/scripts/thestranger.lua

    r3921 r3927  
    22panic = false             -- True if thestranger panics.
    33walkingRouteOne = false   -- True if thestranger is walking route one
    4 randinit = false
    5 
    6 function randInit()
    7 
    8 if not randinit then
    9 math.randomseed(os.clock())
    10 randinit = true
    11 end
    12 
    13 end
    144
    155
     
    3323function tick(timestep)
    3424
    35 randInit()
    36 
    37 randNum = math.random()
    38 io.write("random number is ", randNum, "\n")
    39 
    4025if not walkingRouteOne then
    4126walkRouteOne()
Note: See TracChangeset for help on using the changeset viewer.