class StarWars

Public Class Methods

clear() click to toggle source
# File lib/star_wars.rb, line 57
def self.clear
  1000.times { puts "" }
end
opening_crawl(episode = 'IV') click to toggle source
# File lib/star_wars.rb, line 14
def self.opening_crawl(episode = 'IV')
  system "clear" or system "cls"

  clear

  puts 'A long time ago, in a galaxy far, far away....'.blue.center(@cols)
  sleep(2)

  clear

  title

  case episode
    when 'I'
      title = "Episode I|THE PHANTOM MENACE"
    when 'II'
      title = "Episode II|ATTACK OF THE CLONES"
    when 'III'
      title = "Episode III|REVENGE OF THE SITH"
    when 'V'
      title = "Episode V|THE EMPIRE STRIKES BACK"
    when 'VI'
      title = 'Episode VI|RETURN OF THE JEDI'
    else
      title = ""
  end

  title.split('|').each do |title|
    puts title.yellow.center(@cols)
  end

  puts ''
  sleep(1)

  crawl = "It is a period of civil war.|Rebel spaceships, striking|from a hidden base, have|won their first victory|against the evil Galactic Empire.||During the battle, rebel spies managed|to steal secret plans to the Empire's|ultimate weapon, the DEATH STAR, an|armored space station with enough|power to destroy an entire planet.||Pursued by the Empire's sinister agents,|Princess Leia races home aboard her|starship, custodian of the stolen plans|that can save her people and restore|freedom to the galaxy...."
  crawl.split('|').each do |line|
    puts line.yellow.center(@cols)
    sleep(1)
  end

  100.times { puts ""; sleep(1) }
end
title() click to toggle source
# File lib/star_wars.rb, line 61
def self.title
  puts '
                _________________      ____         __________
   .       .    /                 |    /    \    .  |          \
       .       /    ______   _____| . /      \      |    ___    |     .     .
               \    \    |   |       /   /\   \     |   |___>   |
             .  \    \   |   |      /   /__\   \  . |         _/             .
   .     ________>    |  |   | .   /            \   |   |\    \_______    .
        |            /   |   |    /    ______    \  |   | \           |
        |___________/    |___|   /____/      \____\ |___|  \__________|    .
    .     ____    __  . _____   ____      .  __________   .  _________
         \    \  /  \  /    /  /    \       |          \    /         |      .
          \    \/    \/    /  /      \      |    ___    |  /    ______|  .
           \              /  /   /\   \ .   |   |___>   |  \    \
     .      \            /  /   /__\   \    |         _/.   \    \
             \    /\    /  /            \   |   |\    \______>    |   .
              \  /  \  /  /    ______    \  |   | \              /          .
   .       .   \/    \/  /____/      \____\ |___|  \____________/
                                 .
                                             .               .
  '.yellow.center(@cols)

    sleep(2)

    10.times { puts ""; sleep(1) }
end