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.

Picture Problems xD

Hey all,
I've been making a title screen (very basic) and haven't been able to test it yet, as I cannot see the images (as in, they do not display. No error.)
From my experimenting, it seems there is a Black 640 x 480 square that my pictures cannot show over, from trial and error and resolution scripts.
Here's the script, and you'll need to make three images to do the testing.

Code:
class Scene_Opening

  def initialize

    @fades_in = []

    @fades_in[0] = 60

    @fades_in[1] = 60

    @fades_in[2] = 60

    @fades_in[3] = 30 #enter fade in

    @fades_in[4] = 30 #enter flash in

    @fades_out = []

    @fades_out[3] = 30 #enter fade out

    @fades_out[4] = 30 #inter flash out

    @pathname = 'Graphics/Titles/'

  end

  

  def main

    @picture = []

    @picture[0] = Sprite.new

    @picture[1] = Sprite.new

    @picture[2] = Sprite.new

    @picture[0].bitmap = Bitmap.new(@pathname + 'backGround')

    @picture[1].bitmap = Bitmap.new(@pathname + 'Press Enter')

    @picture[2].bitmap = Bitmap.new(@pathname + 'Logo')

    

    for i in 0...@picture.length

      @picture[i].ox = 0

      @picture[i].oy = 0

      # Center sprite on screen

      @picture[i].x = 0

      @picture[i].y = 0

      @picture[i].opacity = 0

    end

    @bg_fade = true

    @logo_fade = false

    @loop_enter = false

    loop do

      Graphics.update

      Input.update

      frame_update

      break if $scene != self

    end

    Graphics.freeze

    for i in 0...@picture.length

      @picture[i].dispose

    end

  end

  

  def frame_update

    for i in 0...@picture.length

      @picture[i].update

    end

    if @bg_fade

      if @picture[0].opacity < 255

        @picture[0].opacity += 255/@fades_in[0]

        if @picture[0].opacity >= 255

          @intro_fade = false

          @picture[0].opacity = 255

          @logo_fade = true

        end

      end

      return

    end

    if @logo_fade

      if @picture[2].opacity < 255

        @picture[2].opacity += 255/@fades_in[2]

        if @picture[2].opacity >= 255

          @logo_fade = false

          @picture[2].opacity = 255

          @enter_fade = true

        end

      end

      return

    end

    if @enter_fade

      if @picture[1].opacity < 255

        @picture[1].opacity += 255/@fades_in[1]

        if @picture[1].opacity >= 255

          @enter_fade = false

          @picture[1].opacity = 255

          @loop_enter = true

        end

      end

      return

    end

    if @animate_enter

      if @enter_darker

        @picture[1].opacity -= 255/@fades_out[4]

        if @picture[1].opacity == 0

          @flash_loop += 1

          @enter_darker = false

        end

      else

        @picture[1].opacity += 255/@fades_out[4]

        if @picture[1].opacity == 255

          @flash_loop += 1

          @enter_darker = true

        end

      end

      if @flash_loop >= 5

        $scene = Scene_Connect.new

      end

      return

    end

    

      

    if @loop_enter

      update_enter

      update_inputs

    end

      

  end

  

  def update_enter

    if @wait > 0

      @wait -= 1

      return

    end

    if @fading_in_enter

      @picture[1].opacity += 255/@fades_in[3]

      if @picture[1].opacity >= 255

        @picture[1].opacity = 255

        @fading_out_enter = false

      end

    else

      @picture[1].opacity -= 255/@fades_out[3]

      if @picture[1].opacity <= 0

        @picture[1].opacity = 0

        @fading_out_enter = true

      end

    end

    return

  end

  

  def update_inputs

    if Input.triggerd(Input::C) and @animate_enter != true

      Audio.se_play(SE_NAME,SE_VOL_SE_PITCH) if SE_NAME != ''

      @animate_enter = true

    end

  end

  

end

  

 

I cant understand why it won't show - I haven't used bitmaps much before.
If you could help, that'd be amazing :)

PS. No need to tell me if the x, y, ox, oy values are incorrect. I know they're probably wrong, but nothing works (i've gone through as many combinations as i can think of) :\
 
Try creating a viewport and setting it to the Sprites when they are initialized.

Code:
    viewport = Viewport.new(0, 0, 640, 480)

    viewport.z = 9999

    @picture[0] = Sprite.new(viewport)

    @picture[1] = Sprite.new(viewport)

    @picture[2] = Sprite.new(viewport)

I didn't really look at the code in-depth at all, but this is a common thing that can happen that won't let you see the sprite, depending on how you are using it.
 
I'm assuming you are calling this in place of Scene_Title in Main, correct?

If so, there is a Graphics.freeze before it calls the scene (Check Main) but there is no Graphics.transition in your scene to clear it. Either comment out or delete the Graphics.freeze in Main, or add a Graphics.transition before you start showing your pictures.

That would explain the 640x480 black square, no matter what resolution you use.
 

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