Module: TyranoDsl::ParsingWords::DeclareBackground
- Includes:
- ParsingWordsModule
- Defined in:
- lib/tyrano_dsl/parsing_words/declare_background.rb
Instance Method Summary collapse
Instance Method Details
#declare_background(background_name, image_path) ⇒ void
This method returns an undefined value.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/tyrano_dsl/parsing_words/declare_background.rb', line 14 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 |