Sha256: 2acfb22a9a1c07a87e31509daed5c63cdd5ca77f304aa82dd4c3e295be666b20

Contents?: true

Size: 841 Bytes

Versions: 9

Compression:

Stored size: 841 Bytes

Contents

class Gamefic::Entity
  attr_accessor :image
  def has_image?
    (@image.to_s != '')
  end
end

class Gamefic::Character
  attr_writer :sees_image
  def sees_image?
    (@sees_image != false)
  end
  def show_image(filename)
    stream "<img src=\"#{filename}\" />";
    @sees_image = true
  end
  def play_sound(filename, loop = false)
    # TODO: Implement
  end
  def play_ambient(filename, loop = false)
    # TODO: Implement
  end
end

assert_action :clear_last_image do |actor, action|
  actor.sees_image = false
  true
end

respond :look, Query::Visible.new() do |actor, subject|
  actor.proceed
  if subject.has_image?
    actor.show_image subject.image
  end
end

on_player_update do |actor|
  if !actor.sees_image? and actor.room.has_image?
    actor.show_image actor.room.image
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
gamefic-sdk-1.6.0 scripts/multimedia.plot.rb
gamefic-sdk-1.5.0 scripts/multimedia.plot.rb
gamefic-sdk-1.4.1 scripts/multimedia.plot.rb
gamefic-sdk-1.4.0 scripts/multimedia.plot.rb
gamefic-sdk-1.3.1 scripts/multimedia.plot.rb
gamefic-sdk-1.3.0 scripts/multimedia.plot.rb
gamefic-sdk-1.2.0 scripts/multimedia.plot.rb
gamefic-sdk-1.1.0 scripts/multimedia.plot.rb
gamefic-sdk-1.0.1 scripts/multimedia.plot.rb