














-- respawn point rough code -- not copyable but gives you the idea
obj = -1;
function onInit(objID)
   obj = objID;
   -- start timer on 100ms or something to keep the frames fast as every frame is not required
end
function onTimer() -- not actual function,, again this is rough
   if(numZombies < maxSpawnAmount)then
      -- spawn a zombie into the scene
      id = entity.spawnPreset("zombie") -- and all other properties
      -- call function in zombie script and set area id.
   end
end
-- rough code, not copyable all from head
function onUpdate(td)
   hitID = physics.rayFromPoint() -- or whatever command
   if(hitID ~= -1)then
      if( hitID == switchID )then 
          -- open door -- trigger explosions etc...
      end
      if( hitID == VehicleID )then 
          -- get distance from ray not using the getDistance function
                         if(distance < 2)then
                              -- get in car
                         end
      end
   end
end




Users browsing this forum: No registered users and 5 guests