cellDoorOpened = false walkinCellFinished = false cellExitReached = false exitReached = false hangarReached = false spaceShipReached = false spaceShipEntered = false randTime = 0 function setCellDoor(timestep) cellDoorOpened = true return true end function walkInCell(timestep) if cellDoorOpened then if randTime == 0 then randTime = 30 * math.random() else randTime = randTime - timestep end if randTime < 0 then -- goto cellexit -- if exit reached: return true end end return false end function goToExit(timestep) -- do not forget to make him wait until the player triggeres the trip to the hangar return false end function goToHangar(timestep) return false end function goToSpaceship(timestep) return false end function enterSpaceship(timestep) return false end function tick(timestep) --io.write("Prisoner called \n") if not cellDoorOpend then walkinCellFinished = walkInCell(timestep) end if walkinCellFinished and not exitReached then exitReached = goToExit(timestep) end if exitReached and not hangarReached then hangarReached = goToHangar(timestep) end if hangarReached and not spaceShipReached then spaceShipReached = goToSpaceship(timestep) end if spaceShipReached and not spaceShipEntered then spaceShipEntered = enterSpaceship(timestep) end if spaceShipEntered then return true end return false end