Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Menu and picture help

Hey everyone it's been a while since I have scripted anything. (I'm an evener mapper for a reason)

Anyhow I just kick started my new menu but for the life of me I can't work out images.
Right now I'm only attempting to create my background image.

I get an error saying
line 13 name error
undefined local variable or method 'sprite' for #<Scene_menu:0x15ebc40@scene_menu=false>

I'm not using any form of SDL or anything and don't want to neither.
So if someone can help show me the method to creating pictures I would appreciate it as I have been trying to take exampl of pre-existing scripts yet still appear to be doing something wrong.

Code:
#==============================================================================

# ** Scene_Menu2

#------------------------------------------------------------------------------

#  This class performs menu screen processing.

#==============================================================================

 

class Scene_Menu

  def initialize

    @Scene_Menu = false

  end

  if Scene_Menu = true

    def main

      @background = sprite.new

      @background.bitmap = RPG::Cache.picture("main menu")      

      @spriteset = Spriteset_Map.new

      # Make play time window

      @playtime_window = Window_PlayTime2.new

      @playtime_window.x = 488

      @playtime_window.y = 416

      @playtime_window.opacity = 0

      # Make steps window

      @steps_window = Window_Steps2.new

      @steps_window.x = 352

      @steps_window.y = 416

      @steps_window.opacity = 0

      # Make gold window

      @gold_window = Window_Gold2.new

      @gold_window.x = 216

      @gold_window.y = 416

      @gold_window.opacity = 0

      Graphics.transition

      # Main loop

      loop do

      # Update game screen

      Graphics.update

      # Update input information

      Input.update

      # Frame update

      update

      # Abort loop if screen is changed

      if $scene != self

        break

      end

    end

    # Prepare for transition

    Graphics.freeze

    # Dispose of windows

    @playtime_window.dispose

    @steps_window.dispose

    @gold_window.dispose

    @spriteset.dispose

    @background.dispose

  end

  #--------------------------------------------------------------------------

  # * Frame Update

  #--------------------------------------------------------------------------

  def update

    # Update windows

    @playtime_window.update

    @steps_window.update

    @gold_window.update

  end

  else

    @playtime_window.dispose

    @steps_window.dispose

    @gold_window.dispose

    @spriteset.dispose

    @background.dispose

  end

end

Thank you!

(ps. please use dumb-ass language when talking about scripts, as my scripting ability is lax, if possible)
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top