<?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="Squaring the Circle" el:subtitle="" el:id="nat16"/>
      <el:version el:score="1" el:release="1" el:revision="0" el:status="released"/>
      <el:author  el:name="Nat Pryce" el:email="" el:homepage=""/>
      <el:copyright>Copyright © 2003 Nat Pryce</el:copyright>
      <el:license el:type="GPL version 2" el:open="true"/>
      <el:compatibility el:enigma="0.92">
      </el:compatibility>
      <el:modes el:easy="true" 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[
enigma.ConserveLevel = FALSE 

create_world( 20, 13 )
draw_checkerboard_floor( "fl-rough-blue", "fl-rough-red",
                         0, 0, level_width, level_height )
draw_border( "st-wood_001" )

oxyd_default_flavor = "a"
oxyd(3,0)
oxyd(7,0)
oxyd(12,0)
oxyd(16,0)
oxyd(3,12)
oxyd(7,12)
oxyd(12,12)
oxyd(16,12)
oxyd(0,6)
oxyd(19,6)
oxyd_shuffle()

PLAYER_X = 10
PLAYER_Y = 6.5
player1 = set_actor( "ac-blackball", PLAYER_X, PLAYER_Y )

if not difficult then
    RADIUS = 2.5 -- easy mode
else
    RADIUS = 1.5 -- difficult mode
end
BALL_COUNT = 20
BAND_STRENGTH = 10
BAND_LENGTH = 2*RADIUS*sin(360/(2*BALL_COUNT))

last_ball = nil
first_ball = nil
for theta=0,359,360/BALL_COUNT do
    x = PLAYER_X + RADIUS*cos(theta)
    y = PLAYER_Y + RADIUS*sin(theta)
    
    new_ball = set_actor( "ac-killerball", x, y, 
                          {mouseforce=1, controllers=1} )
    if last_ball then
        AddRubberBand( last_ball, new_ball, BAND_STRENGTH, BAND_LENGTH )
    else
        first_ball = new_ball
    end
    last_ball = new_ball
end
AddRubberBand( last_ball, first_ball, BAND_STRENGTH, BAND_LENGTH )
    ]]></el:luamain>
    <el:i18n>
      <el:string el:key="title">
        <el:english el:translate="false"/>
      </el:string>
    </el:i18n>
  </el:protected>
</el:level>
