module TyranoDsl::ParsingWords::DeclareBackground
Public Instance Methods
declare_background(background_name, image_path)
click to toggle source
@param [String] background_name @param [String] image_path @return [void] @raise [TyranoDsl::TyranoException]
# File lib/tyrano_dsl/parsing_words/declare_background.rb, line 9 def declare_background(background_name, image_path) image_full_path = file_full_path(image_path) if context.world.backgrounds.key? background_name raise TyranoDsl::TyranoException, "Duplicated background [#{background_name}]" end context.world.backgrounds[background_name] = TyranoDsl::Elements::Background.new( background_name, image_full_path, context.world.backgrounds.length + 1 ) add_parsed_word( TyranoDsl::Vocabulary::DECLARE_BACKGROUND, name: background_name, image_path: image_full_path ) end