Difference between revisions of "MessageInABottle"

(Created a library page for Message in a Bottle)
 
Line 1: Line 1:
 
__TOC__
 
__TOC__
 
==About==
 
==About==
 +
[[File:MessageInABottle.png]]
 
This is a Message management library for LOVE. This library requires [[MiddleClass]].
 
This is a Message management library for LOVE. This library requires [[MiddleClass]].
  

Revision as of 00:54, 19 November 2010

About

MessageInABottle.png This is a Message management library for LOVE. This library requires MiddleClass.

Contact

No forum post yet. Go to the Issue Tracker for bugs. Look around for TechnoCat if you have any further questions or concerns.

Features

  • Button Bottles
  • Timed Bottles
  • Ocean, a management object for Bottles
  • Very (and hopefully easily) Configurable Bottles
  • Sleek and Stylish Bottle defaults

Missing Features

Not implemented yet, but plan to.

  • Boolean Bottles
  • Choice Bottles

Example

require 'MessageInABottle.lua'

function love.load()
  love.graphics.setBackgroundColor(255,255,255)
  
  --Initialize the ocean to manage the bottles.
  --It is going to act as a Queue. FIFO
  ocean = Ocean:new()
  
  --Create a timed bottle and add it to the ocean
  ocean:addBottle(TimeBottle:new(nil,"...",nil))
  
  local bottle = StayBottle:new(nil,"What is this?")
  bottle:setX(310)
  bottle:setVolume(0)
  ocean:addBottle(bottle)
end

function love.update(dt)
  ocean:update(dt)
end

function love.draw()
  background:draw()
  love.graphics.setColor(0,0,0)
  love.graphics.print(
      'last bottle return was: '..ocean.response..
      ' at '..(math.floor(ocean.responseTime*10)/10)..
      's from '..ocean.responseID,12,12)
  ocean:draw()
end

function love.keypressed(k,u)
  if k=="d" then
    local x = math.floor(math.random(400))
    local y = math.floor(math.random(150))
    ocean:addBottle(TimeBottle:new("PRESSED_D","Timed Box!"))
  elseif k=="escape" then
    love.event.push("q")
  end
end

See Also