Challenge: 
Winner?: 
Yes
Code Snippet: 
Rem Project: SuperPong
Rem Created: 3/26/2007 4:42:36 PM

Rem ***** Main Source File *****

SYSTEM_init()

global win as boolean
global score1 as dword
global score2 as dword
global speed as float
global repush as dword

local keypress as string
local direction as float

do

BALL_nuke()
PADDLE_nuke()
GOAL_nuke()
GENERATOR_nuke()
OBSTACLE_nuke()

do

  cls

  set text size 64
  center text screen width()/2, screen height()/4, "SuperPong"
  set text size 32

  center text screen width()/2, screen height()/2-40, "(1) Classic"
  center text screen width()/2, screen height()/2, "(2) Adventure"
  center text screen width()/2, screen height()/2+40, "(3) Quit"
  
  keypress = inkey$()
  if keypress = "1" or keypress = "2" then exit
  if keypress = "3" then end
  set text size 16
  text screen width()-text width("(C) Code Dragon 2007"), screen height()-20, "(C) Code Dragon 2007"

  sync

loop

levelnum = 0

if keypress = "1"

  speed = .1
  repush = 1
  score1 = 0
  score2 = 0

  LEVELLOADER_load("Classic.txt")
  
  CAMERA_rotate(0, 180, camera_distance)
  
  do
    BALL_update()
    PADDLE_update()
    
    if repush
      dec repush
      if repush = 0
        inc speed, .01
        direction = rnd(90) + (rnd(1)*4-1)*45
        BALL_push(0, newxvalue(0, direction, speed), 0, newzvalue(0, direction, speed))
      endif
    endif
    
    CAMERA_update(0)
    center text screen width()/2, 0, "Classic"
    text 0, 0, "Blue Score: " + str$(score2)
    text screen width() - text width("Red Score: " + str$(score1)), 0, "Red Score: " + str$(score1)
    if escapekey() then exit
    sync
    
  loop
  
else

  levelnum = 1
  LEVELLOADER_load("Level 1.txt")

  do

    GOAL_update()
    
    if win
      win = 0
      do
        cls
        set text size 64
        center text screen width()/2, screen height()/2-20, "Congratulations!"
        center text screen width()/2, screen height()/2+30, "You Win!"
        set text size 32
        center text screen width()/2, screen height()-40, "Press enter key to continue"
        if returnkey() then exit
        sync
      loop
      exit
    endif
    
    GENERATOR_update()
    BALL_update()
    PADDLE_update()

    CAMERA_update(1)
    center text screen width()/2, 0, "Level " + str$(levelnum) + ": " + levelname
    if escapekey() then exit
    sync

  loop
  
endif

loop


function SYSTEM_init()
  
  sync on
  sync rate 60

  set display mode 1280, 768, 32

  ink rgb(0, 255, 0), 0
  set text font "Comic Sans MS"
  set text size 64

  hide mouse
  disable escapekey

  FILEEXTRACTER_init()
  LEVELLOADER_init()
  CAMERA_init()
  BALL_init()
  PADDLE_init()
  GENERATOR_init()
  GOAL_init()
  OBSTACLE_init()

endfunction
Rem *** Include File: BALL.dba ***
Rem Created: 3/26/2007 4:43:23 PM

Rem Included in Project: C:Program FilesThe Game CreatorsDark Basic ProfessionalProjectsSuperPongSuperPong.dbpro

type ball
  object as dword
  px as float
  py as float
  pz as float
  sx as float
  sy as float
  sz as float
endtype

function BALL_init()

  dim ball() as ball

endfunction

function BALL_new()

  local index as dword

  array insert at bottom ball()
  ball().object = make_obj_sphere(1)
  color object ball().object, rgb(255, 0, 255)

  index = array count(ball())

endfunction index

function BALL_delete(index as dword)

  delete object ball(index).object
  array delete element ball(), index

endfunction

function BALL_nuke()

  local total as integer
  local index as dword
  
  total = array count(ball())
  if total = -1 then exitfunction
  
  for index = 0 to total
    BALL_delete(0)
  next index

endfunction

function BALL_push(index as dword, x as float, y as float, z as float)

  inc ball(index).sx, x
  inc ball(index).sy, y
  inc ball(index).sz, z
  
endfunction

function BALL_stop(index as dword)

  ball(index).sx = 0
  ball(index).sy = 0
  ball(index).sz = 0
  
endfunction

function BALL_position(index as dword, x as float, y as float, z as float)

  ball(index).px = x
  ball(index).py = y
  ball(index).pz = z
  position object ball(index).object, x, y, z

endfunction

function BALL_update()

  local total as integer
  local index as dword
  local generator_total as integer
  local generator as dword
  local colx as float
  local coly as float
  local colz as float
  local skip as boolean

  total = array count(ball())
  if total = -1 then exitfunction
  
  generator_total = array count(generator())

  for index = 0 to total
  
    `delete ball if it's too far away
    if obj_distance(ball(index).object, 0, 0, 0) > 100
    
      BALL_delete(index)
      dec total
      if total = -1 then exitfunction
      
    else

      if object collision(ball(index).object, 0)
      
        `calculate collision
        colx = get object collision x()
        coly = get object collision y()
        colz = get object collision z()
        dec ball(index).px, colx
        dec ball(index).py, coly
        dec ball(index).pz, colz

        `make the ball bounce
        if colx then colx = -2 * ball(index).sx
        if coly then coly = -2 * ball(index).sy
        if colz then colz = -2 * ball(index).sz

        BALL_push(index, colx, coly, colz)

      endif

      `apply momentum
      inc ball(index).px, ball(index).sx
      inc ball(index).py, ball(index).sy
      inc ball(index).pz, ball(index).sz
      
      if levelnum = 0 and abs(ball(index).pz) > 15
        if ball(index).pz > 15
          inc score1
        else
          inc score2
        endif
        
        BALL_position(index, 0, 0, 0)
        BALL_stop(index)
        repush = 90
        
      endif

      position object ball(index).object, ball(index).px, ball(index).py, ball(index).pz
      
    endif

  next index

endfunction
Rem *** Include File: CAMERA.dba ***
Rem Created: 3/27/2007 7:19:36 PM

Rem Included in Project: C:Program FilesThe Game CreatorsDark Basic ProfessionalProjectsSuperPongSuperPong.dbpro

global camera_zenith as float
global camera_azimuth as float
global camera_distance as float
global camera_x as float
global camera_y as float
global camera_z as float

function CAMERA_init()

  autocam off

endfunction

function CAMERA_rotate(zenith as float, azimuth as float, distance as float)

  camera_zenith = zenith
  camera_azimuth = azimuth
  camera_distance = distance

endfunction

function CAMERA_position(x as float, y as float, z as float)

  camera_x = x
  camera_y = y
  camera_z = z

endfunction

function CAMERA_orbit(degrees as dword)

  local caption as string
  
  if levelnum
    caption = "Level " + str$(levelnum) + ": " + levelname
  else
    caption = levelname
  endif

  repeat
    inc camera_azimuth
    dec degrees
    CAMERA_update(0)
    center text screen width()/2, screen height()/2, caption
    sync
  until degrees = 0

endfunction

function CAMERA_spiral(degrees as float)

  repeat
    inc camera_azimuth, 1.5
    inc camera_distance
    dec degrees, 1.5
    CAMERA_update(0)
    center text screen width()/2, screen height()/2, "Level " + str$(levelnum) + ": " + levelname
    center text screen width()/2, screen height()/2+64, "Clear"
    sync
  until degrees <= 0

endfunction

function CAMERA_swing(zenith as float, azimuth as float, distance as float)

  local caption as string
  local interval as dword
  local time as dword

  if levelnum
    caption = "Level " + str$(levelnum) + ": " + levelname
    interval = 75
    time = 100
  else
    caption = levelname
    interval = 40
    time = 250
  endif

  for count = 0 to time
    camera_zenith = curveangle(zenith, camera_zenith, interval)
    camera_azimuth = curveangle(azimuth, camera_azimuth, interval)
    camera_distance = curvevalue(distance, camera_distance, interval)
    CAMERA_update(0)
    if levelnum then center text screen width()/2, screen height()/2, caption
    sync
  next count

endfunction

function CAMERA_update(controllable as boolean)

  local x as float
  local y as float
  local z as float

  `control camera using mouse
  if controllable
    dec camera_zenith, -mousemovey() / 10.0
    inc camera_azimuth, mousemovex() / 10.0
    inc camera_distance, -mousemovez() / 100.0
  endif

  `keep sphereical coordinates within boundaries
  if camera_zenith < 1 then camera_zenith = 1
  if camera_zenith > 179 then camera_zenith = 179
  camera_azimuth = wrapvalue(camera_azimuth)
  if camera_distance < 1 then camera_distance = 1
  if controllable and camera_distance > 90 then camera_distance = 90

  `convert spherical coordinates to cartesian cordinates
  x = camera_x + camera_distance * cos(camera_azimuth) * sin(camera_zenith)
  y = camera_y + camera_distance * cos(camera_zenith)
  z = camera_z + camera_distance * sin(camera_azimuth) * sin(camera_zenith)

  position camera x, y, z
  point camera camera_x, camera_y, camera_z

endfunction
Rem *** Include File: Dynamic Media.dba ***
Rem Created: 3/26/2007 4:46:04 PM

Rem Included in Project: C:Program FilesThe Game CreatorsDark Basic ProfessionalProjectsSuperPongSuperPong.dbpro

function free_obj()

  local id as dword

  repeat
    inc id
  until object exist(id) = 0

endfunction id

function free_img()

  local id as dword

  repeat
    inc id
  until image exist(id) = 0

endfunction id

function free_spr()

  local id as dword

  repeat
    inc id
  until sprite exist(id) = 0

endfunction id

function get_image(left as dword, top as dword, right as dword, bottom as dword, textureflag as dword)

  local id as dword

  id = free_img()
  get image id, left, top, right, bottom, textureflag

endfunction id

function make_spr(xpox as integer, ypos as integer, img as dword)

  local id as dword

  id = free_img()
  sprite id, xpos, ypos, img

endfunction id

function open_to_read(filename as string)

  local id as dword
  id = free_file()
  open to read id, filename

endfunction id

function free_file()

  local id as dword

  repeat
    inc id
  until file open(id) = 0

endfunction id

function make_obj_sphere(size as float)

  local id as dword

  id = free_obj()
  make object sphere id, size

endfunction id

function make_obj_cube(size as float)

  local id as dword

  id = free_obj()
  make object cube id, size

endfunction id

function make_obj_box(width as float, height as float, depth as float)

  local id as dword

  id = free_obj()
  make object box id, width, height, depth

endfunction id
Rem *** Include File: GENERATOR.dba ***
Rem Created: 3/30/2007 4:00:09 PM

Rem Included in Project: C:Program FilesThe Game CreatorsDark Basic ProfessionalProjectsSuperPongSuperPong.dbpro

type generator
  object as dword
  px as float
  py as float
  pz as float
  
  bx as float
  by as float
  bz as float

  delay as dword
  time as dword

endtype

function GENERATOR_init()

  global dim generator() as generator

endfunction

function GENERATOR_new()

  local index as dword

  array insert at bottom generator()
  generator().object = make_obj_cube(.8)
  set object collision off generator().object
  color object generator().object, rgb(255, 255, 0)
  generator().delay = 60
  generator().time = generator().delay

  index = array count(generator())

endfunction index

function GENERATOR_delete(index as dword)

  delete object generator(index).object
  array delete element generator(), index

endfunction

function GENERATOR_nuke()

  local total as integer
  local index as dword

  total = array count(generator())
  if total = -1 then exitfunction

  for index = 0 to total
    GENERATOR_delete(0)
  next index

endfunction

function GENERATOR_set(index as dword, speed as dword, x as float, y as float, z as float)

  generator(index).delay = speed
  generator(index).bx = x
  generator(index).by = y
  generator(index).bz = z

endfunction

function GENERATOR_position(index as dword, x as float, y as float, z as float)

  generator(index).px = x
  generator(index).py = y
  generator(index).pz = z
  position object generator(index).object, x, y, z

endfunction

function GENERATOR_update()

  local total as integer
  local index as dword
  local ball as dword

  total = array count(generator())
  if total = -1 then exitfunction

  for index = 0 to total

    dec generator(index).time
    if generator(index).time = 0

      generator(index).time = generator(index).delay

      ball = BALL_new()
      BALL_position(ball, generator(index).px, generator(index).py, generator(index).pz)
      BALL_push(ball, generator(index).bx, generator(index).by, generator(index).bz)

    endif

    `yrotate object generator(index).object, 2+object angle y(generator(index).object)

  next index

endfunction
Rem *** Include File: GOAL.dba ***
Rem Created: 3/31/2007 7:15:57 AM

Rem Included in Project: C:Program FilesThe Game CreatorsDark Basic ProfessionalProjectsSuperPongSuperPong.dbpro

global goal_amount as dword

type goal
  object as dword
  px as float
  py as float
  pz as float
  size as float
endtype

function GOAL_init()

  dim goal() as goal

endfunction

function GOAL_new(size as float)

  local index as dword

  array insert at bottom goal()
  goal().object = make_obj_cube(size)
  goal().size = size
  set object collision off goal().object
  color object goal().object, rgb(0, 255, 0)
  
  index = array count(goal())

endfunction index

function GOAL_delete(index as dword)

  delete object goal(index).object
  array delete element goal(), index
  
endfunction

function GOAL_nuke()

  local total as integer
  local index as dword

  total = array count(goal())
  if total = -1 then exitfunction

  for index = 0 to total
    GOAL_delete(0)
  next index

endfunction

function GOAL_position(index as dword, x as float, y as float, z as float)

  goal(index).px = x
  goal(index).py = y
  goal(index).pz = z
  position object goal(index).object, x, y, z

endfunction

function GOAL_update()

  local total as integer
  local index as dword
  local ball_total as integer
  local ball as dword
  
  total = array count(goal())
  if total = -1 then exitfunction
  
  ball_total = array count(ball())
  
  for index = 0 to total

    if ball_total > -1
      for ball = 0 to ball_total
        if objs_distance(goal(index).object, ball(ball).object) < goal(index).size
          BALL_delete(ball)
          dec ball_total
          dec goal_amount
          if goal_amount = 0
            LEVELLOADER_unload()
            inc levelnum
            if file exist("Level " + str$(levelnum) + ".txt") = 0
              win = 1
              exitfunction
            endif
            LEVELLOADER_load("Level " + str$(levelnum) + ".txt")
            exitfunction
          endif
          exit
        endif
      next ball
    endif

    xrotate object goal(index).object, 1+object angle x(goal(index).object)
    yrotate object goal(index).object, 1+object angle y(goal(index).object)

  next index
  
  text screen width() - text width("Goals Needed: " + str$(goal_amount)) - 10, 0, "Goals Needed: " + str$(goal_amount)

endfunction
Rem *** Include File: LEVELLOADER.dba ***
Rem Created: 3/31/2007 8:12:10 AM

Rem Included in Project: C:Program FilesThe Game CreatorsDark Basic ProfessionalProjectsSuperPongSuperPong.dbpro

global levelnum as dword
global levelname as string

function LEVELLOADER_init()

  dim vals(10) as float

endfunction

function LEVELLOADER_load(levelstr as string)

  local level as dword
  local str as string
  local count as dword
  local returnval as dword

  level = open_to_read(levelstr)
  
  while file end(level) = 0
    read string level, str
    
    select str
    
      case "[name]"
        read string level, levelname
      endcase
      
      case "[player]"
        read string level, str
        repeat
          csv$(str)
          for count = 0 to 3
            vals(count) = val(csv$(""))
          next count
          returnval = PADDLE_new(vals(0))
          PADDLE_position(returnval, vals(1), vals(2), vals(3))
          read string level, str
        until str = ""
      endcase
      
      case "[ball]"
        read string level, str
        repeat
          csv$(str)
          for count = 0 to 5
            vals(count) = val(csv$(""))
          next count
          returnval = BALL_new()
          BALL_position(returnval, vals(0), vals(1), vals(2))
          BALL_push(returnval, vals(3), vals(4), vals(5))
          read string level, str
        until str = ""
      endcase
      
      case "[generator]"
        read string level, str
        repeat
          csv$(str)
          for count = 0 to 6
            vals(count) = val(csv$(""))
          next count
          returnval = GENERATOR_new()
          GENERATOR_position(returnval, vals(0), vals(1), vals(2))
          GENERATOR_set(returnval, vals(3), vals(4), vals(5), vals(6))
          read string level, str
        until str = ""
      endcase
      
      case "[goal]"
        read string level, str
        goal_amount = val(str)
        read string level, str
        repeat
          csv$(str)
          for count = 0 to 3
            vals(count) = val(csv$(""))
          next count
          returnval = GOAL_new(vals(3))
          GOAL_position(returnval, vals(0), vals(1), vals(2))
          read string level, str
        until str = ""
      endcase
      
      case "[obstacle]"
        read string level, str
        repeat
          csv$(str)
          for count = 0 to 5
            vals(count) = val(csv$(""))
          next count
          OBSTACLE_new(vals(0), vals(1), vals(2), vals(3), vals(4), vals(5))
          read string level, str
        until str = ""
      endcase
      
      case "[camera]"
      
        read string level, str
        csv$(str)
        for count = 0 to 2
          vals(count) = val(csv$(""))
        next count
        
        read string level, str
        csv$(str)
        for count = 3 to 5
          vals(count) = val(csv$(""))
        next count
        
        read string level, str
        vals(6) = val(str)
        
        read string level, str
        csv$(str)
        for count = 7 to 9
          vals(count) = val(csv$(""))
        next count
        
        CAMERA_position(vals(0), vals(1), vals(2))
        CAMERA_rotate(vals(3), vals(4), vals(5))
        set text size 64
        CAMERA_orbit(vals(6))
        CAMERA_swing(vals(7), vals(8), vals(9))
        
      endcase
      
    endselect
    
  endwhile
  
  set text size 32

endfunction

function LEVELLOADER_unload()

  set text size 64
  set text font "Comic Sans MS"
  CAMERA_spiral(270)
  set text size 32

  BALL_nuke()
  GENERATOR_nuke()
  GOAL_nuke()
  PADDLE_nuke()
  OBSTACLE_nuke()
  
endfunction
Rem *** Include File: Math.dba ***
Rem Created: 3/29/2007 4:15:55 PM

Rem Included in Project: C:Program FilesThe Game CreatorsDark Basic ProfessionalProjectsSuperPongSuperPong.dbpro

function objs_distance(object1 as dword, object2 as dword)

  local distance as float

  distance = sqrt((object position x(object1) - object position x(object2))^2 + (object position y(object1) - object position y(object2))^2 + (object position z(object1) - object position z(object2))^2)

endfunction distance

function obj_distance(object1 as dword, x as float, y as float, z as float)

  local distance as float

  distance = sqrt((object position x(object1) - x)^2 + (object position y(object1) - y)^2 + (object position z(object1) - z)^2)

endfunction distance
Rem *** Include File: PADDLE.dba ***
Rem Created: 3/27/2007 3:15:29 PM

Rem Included in Project: C:Program FilesThe Game CreatorsDark Basic ProfessionalProjectsSuperPongSuperPong.dbpro

type paddle
  object as dword
  controller as dword

  `the controller variable defines who moves the paddle
  #constant paddle_controller_none = 0
  #constant paddle_controller_arrowkeys = 1
  #constant paddle_controller_WASD = 2
  #constant paddle_controller_mouse = 3
  #constant paddle_controller_AI = 4

  px as float
  py as float
  pz as float
endtype

function PADDLE_init()

  dim paddle() as paddle

endfunction

function PADDLE_new(controller as dword)

  local index as dword

  array insert at bottom paddle()
  paddle().object = make_obj_box(2.5, 2.5, .4)
  paddle().controller = controller
  select controller
    case 1
      color object paddle().controller, rgb(255, 0, 0)
    endcase
    case 2
      color object paddle().controller, rgb(0, 255, 255)
    endcase
  endselect

  index = array count(paddle())

endfunction index

function PADDLE_delete(index as dword)

  delete object paddle(index).object
  array delete element paddle(), index

endfunction

function PADDLE_nuke()

  local total as integer
  local index as dword

  total = array count(paddle())
  if total = -1 then exitfunction

  for index = 0 to total
    PADDLE_delete(0)
  next index

endfunction

function PADDLE_position(index as dword, x as float, y as float, z as float)

  paddle(index).px = x
  paddle(index).py = y
  paddle(index).pz = z
  position object paddle(index).object, x, y, z

endfunction

function PADDLE_update()

  local total as integer
  local index as dword
  local controller as dword
  local x as float
  local y as float
  local ball as dword
  local ball_total as integer

  total = array count(paddle())
  if total = -1 then exitfunction
  
  ball_total = array count(ball())

  for index = 0 to total

    `get controller movement
    controller = paddle(index).controller
    x = 0
    y = 0
    select controller
      case paddle_controller_arrowkeys
        x = (rightkey() - leftkey()) / 20.0
        y = (upkey() - downkey()) / 20.0
      endcase
      case paddle_controller_WASD
        x = (keystate(32) - keystate(30)) / 20.0
        y = (keystate(17) - keystate(31)) / 20.0
      endcase
      case paddle_controller_mouse
        x = mousemovex() / 100.0
        y = -mousemovey() / 100.0
      endcase
      case paddle_controller_AI
      endcase
    endselect
    
    if levelnum = 0
      x = y*2
      y = 0
      if paddle(index).px < -8 and x < 0 then paddle(index).px = -8
      if paddle(index).px > 8 and x > 0 then paddle(index).px = 8
    endif

    inc paddle(index).px, x
    inc paddle(index).py, y

    position object paddle(index).object, paddle(index).px, paddle(index).py, paddle(index).pz

    if ball_total > -1
      for ball = 0 to ball_total
        if object collision(paddle(index).object, ball(ball).object)
          `make the ball inherit some of the paddle's momentum
          BALL_push(ball, x/2, y/2, 0)
        endif
      next ball
    endif

  next index

endfunction
Rem *** Include File: String.dba ***
Rem Created: 3/31/2007 8:24:43 AM

Rem Included in Project: C:Program FilesThe Game CreatorsDark Basic ProfessionalProjectsSuperPongSuperPong.dbpro

global csv_start as dword
global csv_values as string

`extracts individual values from a comma separated values string
function csv$(called_values as string)

  local count as dword
  local return_value as string

  `if the function was called with values, replace the saved values
  if called_values <> ""
    csv_values = called_values
    csv_start = 1
    exitfunction ""
  endif

  `if all the tokens have been taken return end of string
  if csv_start > len(csv_values) then exitfunction "END OF STRING"

  `look for a comma
  for count = csv_start to len(csv_values)

    `if the character's a comma, return the token
    if mid$(csv_values, count) = ","
      return_value = right$(left$(csv_values, count - 1), count - csv_start)
      csv_start = count + 1
      exitfunction return_value
    endif

  next count

  `no comma found, so return last token
  return_value = right$(csv_values, count - csv_start)
  csv_start = count

endfunction return_value
Rem *** Include File: FILEEXTRACTER.dba ***
Rem Created: 4/2/2007 8:26:00 AM

Rem Included in Project: C:Program FilesThe Game CreatorsDark Basic ProfessionalProjectsSuperPongSuperPong.dbpro

function FILEEXTRACTER_init()

  local currentlevel as dword
  local str as string

  restore leveldata

  do
    read str
    if str = "[name]"
      if file open(1) = 1 then close file 1
      if currentlevel
        if file exist("Level " + str$(currentlevel) + ".txt") then delete file "Level " + str$(currentlevel) + ".txt"
        open to write 1, "Level " + str$(currentlevel) + ".txt"
      else
        if file exist("Classic.txt") then delete file "Classic.txt"
        open to write 1, "Classic.txt"
      endif
      
      inc currentlevel
    endif
    if str = "EOD" then exit
    write string 1, str
  loop
  close file 1

endfunction

leveldata:


data "[name]"
data "Classic"
data ""
data "[player]"
data "1, 0, 0, -10"
data "2, 0, 0, 10"
data ""
data "[ball]"
data "0, 0, 0, 0, 0, 0"
data ""
data "[obstacle]"
data "0, -1.5, 0, 19, .5, 20"
data "9.25, -.25, 0, .5, 2, 20"
data "-9.25, -.25, 0, .5, 2, 20"
data ""
data "[camera]"
data "0, 0, 0"
data "70, 0, 30"
data "90"
data "0, 180, 30"
data ""
data "[name]"
data "Easy"
data ""
data "[player]"
data "1, 0, 0, 0"
data "2, -5, 0, 5"
data ""
data "[generator]"
data "5, 0, -5, 60, -.1, 0, .1"
data ""
data "[goal]"
data "1"
data "-10, 0, 10, 2"
data ""
data "[camera]"
data "-2.5, 0, 2.5"
data "60, 0, 30"
data "270"
data "70, -60, 20"
data ""
data "[name]"
data "Zigzag"
data ""
data "[player]"
data "1, 0, 0, -10"
data "2, 0, 0, 10"
data ""
data "[generator]"
data "0, 0, 0, 30, -.1, 0, -.1"
data ""
data "[goal]"
data "3"
data "-40, 0, 0, 3"
data ""
data "[camera]"
data "-20, 0, 0"
data "40, 90, 50"
data "180"
data "80, -30, 35"
data ""
data "[name]"
data "Bounce System"
data ""
data "[player]"
data "1, 0, 0, -15"
data "2, 5, 0, 15"
data ""
data "[generator]"
data "-8, 0, 18, 60, .1, 0, -.1"
data ""
data "[goal]"
data "5"
data "4, 0, 0, 1"
data ""
data "[obstacle]"
data "0, -1, 0, 2, .5, 20"
data "-1.25, .25, 0, .5, 2, 20"
data "0, 1.5, 0, 2, .5, 20"
data "1.25, .25, 2.5, .5, 2, 25"
data "9, -1, 0, 2, .5, 20"
data "7.75, .25, 0, .5, 2, 20"
data "9, 1.5, 0, 2, .5, 20"
data "10.25, .25, 0, .5, 2, 20"
data ""
data "[camera]"
data "4, 0, 0"
data "50, 0, 40"
data "180"
data "80, -40, 30"
data ""
data "[name]"
data "Vertical Tunnel"
data ""
data "[player]"
data "1, 0, -5, -5"
data "2, 0, -5, 5"
data ""
data "[generator]"
data "0, -5, 19, 30, -.1, .1, -.1"
data "19, -5, 0, 30, .1, .1, .1"
data "0, -5, -19, 30, .1, .1, .1"
data "-19, -5, 0, 30, .1, .1, -.1"
data ""
data "[goal]"
data "8"
data "0, 50, 0, 12"
data ""
data "[obstacle]"
data "20, 15, 0, 1, 60, 39"
data "0, 15, 20, 39, 60, 1"
data "-20, 15, 0, 1, 60, 39"
data "0, 15, -20, 39, 60, 1"
data "0, -15.5, 0, 39, 1, 39"
data ""
data "[camera]"
data "0, 0, 0"
data "35, 90, 100"
data "180"
data "15, -55, 10"
data "EOD"
Rem *** Include File: OBSTACLE.dba ***
Rem Created: 4/2/2007 11:28:54 AM

Rem Included in Project: C:Program FilesThe Game CreatorsDark Basic ProfessionalProjectsSuperPongSuperPong.dbpro

type obstacle
  object as dword
endtype

function OBSTACLE_init()

  dim obstacle() as obstacle

endfunction

function OBSTACLE_new(x as float, y as float, z as float, width as float, height as float, depth as float)

  array insert at bottom obstacle()
  obstacle().object = make_obj_box(width, height, depth)
  position object obstacle().object, x, y, z

endfunction

function OBSTACLE_delete(index as dword)

  delete object obstacle(index).object
  array delete element obstacle(), index

endfunction

function OBSTACLE_nuke()

  local total as integer
  local index as dword

  total = array count(obstacle())
  if total = -1 then exitfunction

  for index = 0 to total
    OBSTACLE_delete(0)
  next index

endfunction