Battle1

From BerryBots Wiki
Jump to: navigation, search
battle1 325.png
BerryBots
See a replay of Battle1 in action: click here to watch

A sample battle stage packaged with BerryBots as sample/battle1.lua. It features four pillars, one in each corner of the stage, and uses the default scoring from the battlestage scoring module.

Source code

-- A basic battle field with some walls.
--
-- Sample battle ships: Chaser, FloatingDuck, MyFirstShip, RandomBot,
-- WallHugger, and BasicBattler.
 
require "battlestage"
 
function configure(stageBuilder)
  stageBuilder:setSize(1200, 800)
  stageBuilder:setBattleMode(true)
  stageBuilder:addWall(250, 200, 100, 100)
  stageBuilder:addWall(850, 200, 100, 100)
  stageBuilder:addWall(250, 500, 100, 100)
  stageBuilder:addWall(850, 500, 100, 100)
end
 
ships = nil
world = nil
admin = nil
 
function init(shipsArg, worldArg, adminArg)
  ships = shipsArg
  world = worldArg
  admin = adminArg
end
 
function run(stageSensors)
  battlestage.basicScoring(ships, world, admin)
end
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox