Battle2

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

A sample battle stage packaged with BerryBots as sample/battle2.lua. It features two vertical walls, in the middle-left and middle-right 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(300, 225, 10, 350)
  stageBuilder:addWall(895, 225, 10, 350)
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