Post Mon Nov 18, 2013 2:06 am

Beater!

edited stock bitmatch level :)
need to change the name now that i saw bobdaducks beater level

first version of the map. It's just an edited version of the stock bitmatch map.

Next version
  Code:
RabbitGameType 8 99 30 12
LevelName Beater!
LevelDescription "Sort of Gladiators"
LevelCredits "Stock Bitmatch, Edited by T.A.Z."
GridSize 255
Team Blue 0 0 1
Specials
Script AsteroidCore.levelgen
MinPlayers
MaxPlayers
BarrierMaker 50 3.5 0 3 0
BarrierMaker 50 -4.5 0 -4.5 -0.5 -3.5 -1.5 -3 -1.5 -1.5 -3 -1.5 -3.5 -0.5 -4.5 0.5 -4.5 1.5 -3.5 1.5 -3 3 -1.5 3.5 -1.5 4.5 -0.5 4.5 0.5 3.5 1.5 3 1.5 1.5 3 1.5 3.5 0.5 4.5 -0.5 4.5 -1.5 3.5 -1.5 3 -3 1.5 -3.5 1.5 -4.5 0.5 -4.5 -0.5
BarrierMaker 50 0 3.5 0 3
BarrierMaker 50 0 -3.5 0 -3
PolyWall -0.778161 -2.221835 -1.221835 -1.778161 0 -1 1.222702 -1.777294 0.778161 -2.221835 0 -1.443674
BarrierMaker 50 -0.5 3 0.5 3
BarrierMaker 50 -3.5 0 -3 0
BarrierMaker 50 3 -0.5 3 0.5
BarrierMaker 50 -0.5 -3 0.5 -3
PolyWall -2.220074 -0.778133 -1.7764 -1.221807 -1 0 -1.775533 1.222728 -2.220074 0.778188 -1.441914 0.000028
PolyWall -0.778161 2.221835 -1.221835 1.778161 0 1 1.222702 1.777294 0.778161 2.221835 0 1.443674
BarrierMaker 50 -3 -0.5 -3 0.5
PolyWall 2.221835 -0.778161 1.778161 -1.221835 1 0 1.777294 1.222701 2.221835 0.77816 1.443675 0
SlipZone 0.1 1.777294 -1.222702 -1.222702 1.777294 0.554592 0 -1.222702 -1.777294 1.777294 1.222702 1.222702 1.777294 0 0.554592 -1.222702 1.777294 -1.777294 1.222702 1.222702 -1.777294 -0.554592 0 1.222702 1.777294 -1.777294 -1.222702 -1.222702 -1.777294 0 -0.554592 1.222702 -1.777294
Spawn 0 -1.9 0.1
Spawn 0 -2 2
FlagItem -1 0 0
RepairItem 0 4 45
RepairItem 0 -4 45
RepairItem 4 0 45
RepairItem -4 0 45
Spawn 0 0 -1.2
Spawn 0 1.2 0
Spawn 0 0 1.2
Spawn 0 -1.2 0
Spawn 0 -2 -2
Spawn 0 2 -2
Spawn 0 2 2
 

Uses Levelgen



  Code:
tau = math.pi * 2

-------------------------
--copy this block of code if you want multiple swingy-chain items, modifying the center and truecenter values accordingly.
beater1 = {}
beater1["type"] = SoccerBallItem --capitalization is important here.
beater1["center"] = point.new(0, 0) --Just set this to be the same as the "trueCenter" below.
beater1["trueCenter"] = point.new(0, 0) --the center of the chain
beater1["length"] = 4 --how many to make + 1. (so this will do 4)
beater1["objects"] = {} --ignore this
beater1["orbitTime"] = 2500 --2500 milliseconds to make a rotation (2 and a half seconds)
beater1["x"] = 0 --these two x and y variables are added to the ["center"] variable above each time it makes an item.
beater1["y"] = 70 --a resourceItem is about this big.
beater1["orbitDirection"] = -1 -- positive for counter clockwise, negative for clockwise
--If you make multiple, they won't show up unless you add them to the beaterArray below.
--------------------------



beaterArray = {beater1} --if you want more, put them within the {} seperated by commas.  {beater1, beater2}

origin = point.zero

function doBeaters(deltaTime)
    for index, value in ipairs(beaterArray)
    do
        for dex, val in ipairs(value["objects"])
        do
            local t = getMachineTime() % (value["orbitTime"]) / value["orbitTime"]
 
            local center = value["trueCenter"]
            local radius = point.distanceTo(val["loc"], center)
           
            local pos = center + point.new(math.sin((t + 1/5) * tau * value["orbitDirection"]), math.cos((t + 1/5) * tau * value["orbitDirection"])) * radius
            local unitVec = point.normalize(center - pos)
            val["item"]:setVel(point.new(value["orbitDirection"] * -unitVec.y, value["orbitDirection"] * unitVec.x) * tau * radius / (value["orbitTime"] / 1000))
            val["item"]:setLoc(pos)
        end
    end
end

function onTick(deltaTime)
    doBeaters(deltaTime)
end

function main()
    subscribe(Event.tick)
   
    for index, value in ipairs(beaterArray)
    do
        for i = 1, value["length"]
        do
            item = {}
            item["loc"] = value["center"]
            item["item"] = value["type"].new()
            item["item"]:setLoc(value["center"])
            levelgen:addItem(item["item"])
            table.insert(value["objects"], item)
            value["center"] = point.new(value["center"].x + value["x"], value["center"].y + value["y"])
        end
    end
    Timer:scheduleRepeating(function()
        beater11["orbitDirectionction"] = beater11["orbitDirection"] * -1
    end, 360000)
end


archive of first version
  Code:
RabbitGameType 8 50 30 12
LevelName let it slip
LevelDescription Rabbit
LevelCredits "Stock Bitmatch, Edited by T.A.Z."
GridSize 255
Team Blue 0 0 1
Specials
MinPlayers
MaxPlayers
BarrierMaker 50 0 3.5 0 3
BarrierMaker 50 3 -0.5 3 0.5
BarrierMaker 50 -0.5 3 0.5 3
BarrierMaker 50 0 -3.5 0 -3
BarrierMaker 50 -3 -0.5 -3 0.5
BarrierMaker 50 -3.5 0 -3 0
BarrierMaker 50 -4.5 0 -4.5 -0.5 -3.5 -1.5 -3 -1.5 -1.5 -3 -1.5 -3.5 -0.5 -4.5 0.5 -4.5 1.5 -3.5 1.5 -3 3 -1.5 3.5 -1.5 4.5 -0.5 4.5 0.5 3.5 1.5 3 1.5 1.5 3 1.5 3.5 0.5 4.5 -0.5 4.5 -1.5 3.5 -1.5 3 -3 1.5 -3.5 1.5 -4.5 0.5 -4.5 -0.5
BarrierMaker 50 -0.5 -3 0.5 -3
BarrierMaker 50 3.5 0 3 0
BarrierMaker 160 -1 -2 0 -1 1 -2
BarrierMaker 160 2 -1 1 0 2 1
BarrierMaker 160 -1 2 0 1 1 2
BarrierMaker 160 -2 1 -1 0 -2 -1
SlipZone 0.1 1.777294 -1.222702 -1.222702 1.777294 0.554592 0 -1.222702 -1.777294 1.777294 1.222702 1.222702 1.777294 0 0.554592 -1.222702 1.777294 -1.777294 1.222702 1.222702 -1.777294 -0.554592 0 1.222702 1.777294 -1.777294 -1.222702 -1.222702 -1.777294 0 -0.554592 1.222702 -1.777294
RepairItem 0 4 45
RepairItem 0 -4 45
RepairItem 4 0 45
RepairItem -4 0 45
Spawn 0 0 -1
Spawn 0 1 0
Spawn 0 0 1
Spawn 0 -1 0
Spawn 0 -2 -2
Spawn 0 2 -2
Spawn 0 2 2
Spawn 0 -2 2
FlagItem -1 0 0
 
Play my new level! Two different teams fight over a nexus: One mainly defends while the other attacks! is fun
viewtopic.php?f=33&p=21002#p21002