FAQ  •  Register  •  Login

Blizzard Control - levelgen by sam686

<<

sam686

User avatar

Posts: 468

Joined: Fri Oct 15, 2010 8:53 pm

Location: United States, South Dakota

Post Fri Jan 11, 2013 6:55 pm

Blizzard Control - levelgen by sam686

This level was part of December 2012 Level Design Contest maps

Note, this levelgen might not work on stock 018, but it may work on next version of Bitfighter (version 018a and some newer versions)

Name this as blizzard.level
  Code:
GameType 5 20
LevelName "Blizzard Control"
LevelDescription "You are in control of the Blizzard by using a switch"
LevelCredits sam686
GridSize 255
Team Blue 0 0 1
Script blizzard.levelgen
PolyWall -2.7 1.9 -2.7 2.8 -1.3 2.8 -1.3 2.9 -2.7 2.9 -2.7 3 -2.8 3 -2.8 1.9
PolyWall -6 -5 -5.5 -4.5 5.5 -4.5 6 -5
PolyWall -4.2 -2.5 -4.4 -2.5 -3.2 -3.1 -2.6 -2.8 -2.6 -3.1 -2.5 -3.1 -2.5 -2.6 -3.1 -2.9 -3.3 -2.9 -4.1 -2.5 -4.1 -1.6 -2.2 -1.6 -2.2 -1.5 -4.2 -1.5
PolyWall 1 -2.9 0.8 -2.9 2 -3.5 3.2 -2.9 3 -2.9 3 -2.4 2.9 -2.4 2.9 -2.9 2.1 -3.3 1.9 -3.3 1.1 -2.9 1.1 -2.6 2.4 -2.6 2.4 -2.5 1.1 -2.5 1.1 -2 3 -2 3 -1.9 1 -1.9
PolyWall 1 0.4 1.2 0.4 0 -0.2 -1.2 0.4 -0.9 0.4 -0.1 0 0.1 0 0.9 0.4 0.9 0.8 -0.1 0.8 -0.1 0.6 -0.2 0.6 -0.2 0.8 -1 0.8 -1 0.9 1 0.9
PolyWall -2.3 -3.1 -2.3 -2.2 -3.7 -2.2 -3.7 -2.1 -2.3 -2.1 -2.3 -2 -2.2 -2 -2.2 -3.1
PolyWall -0.8 2.5 -0.6 2.5 -1.8 1.9 -2.4 2.2 -2.4 1.9 -2.5 1.9 -2.5 2.4 -1.9 2.1 -1.7 2.1 -0.9 2.5 -0.9 3.4 -2.8 3.4 -2.8 3.5 -0.8 3.5
PolyWall -5.5 4.5 -6 5 6 5 5.5 4.5
PolyWall 5.5 -5 5.5 5 6 5 6 -5
PolyWall 4.3 2.6 4.5 2.6 3.3 2 2.1 2.6 2.3 2.6 2.3 3.1 2.4 3.1 2.4 2.6 3.2 2.2 3.4 2.2 4.2 2.6 4.2 2.9 2.9 2.9 2.9 3 4.2 3 4.2 3.5 2.3 3.5 2.3 3.6 4.3 3.6
PolyWall -6 -5 -6 5 -5.5 5 -5.5 -5
Spawn 0 2 -2.9
Spawn 0 -1.8 2.5
Spawn 0 -3.2 -2.5
Spawn 0 3.3 2.6
Spawn 0 3.9 3.2
Spawn 0 -2.3 3.1
Spawn 0 -3.9 -1.9
Spawn 0 1.4 -2.3
RepairItem -1.1 3.2 20
RepairItem 1.3 -2.8 20
TextItem -1 -0.6 0.4 0.6 0.4 38.491 "Blizzard Control"
LoadoutZone -1 0.9 0.8 0.9 0.6 -0.1 0.6 -0.1 0.8
 


Then, Name this as blizzard.levelgen
  Code:
objects = {}

textitem = nil

enabled = true
waittime = 0

function onShipEnteredZone(ship, zone, zoneType, zoneId)
  if waittime <= 0 then
    if enabled then
      enabled = false
      textitem:setText("OFF")
      for index, object in ipairs(objects) do
        object:setVel(0, 0)
      end
    else
      textitem:setText("ON")
      enabled = true
    end
    textitem:setGeom(textitem:getGeom())  -- this line is to properly send packUpdate to clients
    waittime = 500
  end
end

function onTick(timePassed)
  if waittime >= 0 then
    waittime = waittime - timePassed
  end

  if enabled then
    for index, object in ipairs(objects) do
      vel = object:getVel()
      pos = object:getLoc()
      a = math.atan2(pos.x, pos.y)
      object:setVel(vel.x - math.cos(a) * 2 * timePassed, vel.y + math.sin(a) * 2 * timePassed)
    end
  end
end

function main()
  for a = 1, 100 do
    objects[a] = ResourceItem.new()
    objects[a]:setLoc(math.cos(a * 2.3) * (400 + a), math.sin(a * 2.3) * (400 + a))
    levelgen:addItem(objects[a])
    a=a+1
  end

  textitem = TextItem.new()
  textitem:setText("ON")
  textitem:setGeom(-175, 190, -50, 190)
  levelgen:addItem(textitem)

  enabled = true
  waittime = 0
  subscribe(Event.tick)
  subscribe(Event.ShipEnteredZone)
end
 
<<

YoshiSmb

User avatar

Posts: 87

Joined: Sat Nov 24, 2012 10:38 am

Location: Argentina

Post Sat Jan 12, 2013 10:12 am

Re: Blizzard Control - levelgen by sam686

Sam is the Best Map i Ever See! also. is really good the levelgen.

is really fun to dodge the resources so it's dont push you. :D
:zapdance: Bitfighter forever :zapdance:

Heroes never die!
<<

Fordcars

User avatar

Posts: 1016

Joined: Fri Apr 20, 2012 3:51 pm

Location: Some city, somewhere

Post Sun Jan 13, 2013 12:53 pm

Re: Blizzard Control - levelgen by sam686

Nice code to learn levelgen with.
skybax: Why is this health pack following me?
bobdaduck: uh, it likes you.

Return to Bitmatch

Who is online

Users browsing this forum: No registered users and 3 guests

cron