<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<el:level xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://enigma-game.org/schema/level/1 level.xsd" xmlns:el="http://enigma-game.org/schema/level/1">
  <el:protected>
    <el:info el:type="level">
      <el:identity el:title="esprit 34" el:subtitle="esprit 34" el:id="ss_esp34"/>
      <el:version el:score="2" el:release="2" el:revision="0" el:status="released"/>
      <el:author  el:name="Sven Siggelkow" el:email="" el:homepage=""/>
      <el:copyright>Copyright © 2003 Sven Siggelkow</el:copyright>
      <el:license el:type="GPL v2.0 or above" el:open="true"/>
      <el:compatibility el:enigma="0.92">
       <el:dependency el:path="lib/andreas_ghosts" el:id="lib/andreas_ghosts" el:release="1" el:preload="true"/>
      </el:compatibility>
      <el:modes el:easy="false" el:single="true" el:network="false"/>
      <el:comments>
        <el:code>Lua 5.1 and XML converted by Leveladministrators</el:code>
      </el:comments>
      <el:score el:easy="-" el:difficult="-"/>
    </el:info>
    <el:luamain><![CDATA[
-- problem: here is a spermbird needed (more intelligent killer)
-- Apr.'06: Changed actor into ghost.  Andreas

whichside = 1
ontheright = 0

function mydirection(rail,posx,posy,oldx,oldy)
  -- next time, go to the other side; also change range of rotor
  if posx > levelw - 20 then
    if ontheright == 0 then
      set_attribs(enigma.GetNamedObject("ghost_1"), {range=5})
    end
    ontheright = 1
  else
    if ontheright == 1 then
      set_attribs(enigma.GetNamedObject("ghost_1"), {range=0})
      whichside = 3 - whichside   -- switches between 1 and 2
    end
    ontheright = 0
  end
  -- choose speed
  if (posy == 2) or (posy == 10) then
        if (posx < 12) then          enigma.SlopeForce = 8
    elseif (posx < 18) then          enigma.SlopeForce = -50
    elseif (posx > levelw - 5) then  enigma.SlopeForce = 10
    else                             enigma.SlopeForce = 400  end
  elseif (posy == 4) or (posy == 8) then
        if (posx < 5) then           enigma.SlopeForce = 8
    elseif (posx > levelw - 15) then enigma.SlopeForce = 8    
    elseif (posx > levelw - 20) then enigma.SlopeForce = -50
    else                             enigma.SlopeForce = 400  end
  end
  -- choose direction
      if (posx == 1) and (posy ==  2) then  return 2
  elseif (posx == 1) and (posy ==  3) then  return 2
  elseif (posx == 1) and (posy ==  9) then  return 1
  elseif (posx == 1) and (posy == 10) then  return 1
  elseif (posy == 2) or (posy == 10)  then  return 3
  elseif (posx == levelw - 3)         then  return whichside
  else                                      return 4  end
end

levelw = 191
levelh = 13

create_world(levelw, levelh)
oxyd_default_flavor = "d"
set_actor("ac-blackball", 3.5,6.5)
--set_actor("ac-rotor", 188.5,3.5, {range=200, force=60})
ghosts_set_ghost(levelw-3,6,"ac-rotor",1,mydirection, {range=5, force=30, gohome=FALSE})
fill_floor("fl-brick",0,0,levelw,levelh)

ghosts_set_railarea( 1, 2, levelw-3, 2,          1,"")
ghosts_set_railarea( 1, 4, levelw-3, 4,          1,"")
ghosts_set_railarea( 1, 8, levelw-3, 8,          1,"")
ghosts_set_railarea( 1,10, levelw-3,10,          1,"")
ghosts_set_railarea( levelw-3, 2, levelw-3, 10,  1,"")
ghosts_set_rail    ( 1, 3,                       1,"")
ghosts_set_rail    ( 1, 9,                       1,"")
ghosts_check_for_walls = 0

enigma.SlopeForce=30
draw_border("st-rock1")
draw_stones("st-rock1", { 1, 1},{ 1, 0},189)
draw_stones("st-rock1", { 1, 11},{ 1, 0},189)
draw_stones("st-rock1", { 3, 3},{ 1, 0},181)
draw_stones("st-rock1", { 3, 9},{ 1, 0},181)
draw_stones("st-rock1", { 1, 5},{ 1, 0},187)
draw_stones("st-rock1", { 1, 7},{ 1, 0},187)
set_stones("st-rock1",{{184,3},{184,9}})
set_stones("st-oneway-e",{{184,4},{184,8},{187,6}})
set_stones("st-oneway-s",{{1,3},{183,5}})
set_stones("st-oneway-n",{{1,9},{183,7}})
oxyd(0,6)
oxyd(2,3)
oxyd(2,9)
oxyd(189,6)
oxyd_shuffle()
ghosts_init(0,0)
    ]]></el:luamain>
    <el:i18n>
      <el:string el:key="title">
        <el:english el:translate="false"/>
      </el:string>
    </el:i18n>
  </el:protected>
</el:level>
