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.

Please help with this SMALL script

Howdy,

I made this script using a tutorial but it doesn't work!
Code:
 

class Scene_Boekjeuh

  def initialize

    $pagina = 0

    $spr = Sprite.new

  end

 

  def main

    $spr.bitmap = Bitmap.new("Graphics/Pictures/bp"+$pagina.to_s)

    $spr.x = (640 / 2) - ($spr.bitmap.width / 2)

    $spr.y = (480 / 2) - ($spr.bitmap.height / 2)

    $spr.z = 1000

    loop do

      Graphics.update

      Input.update

      update

    end

  end

  

  def update

    if Input.trigger?(Input::B)

      $scene = Scene_Map.new   

    end

    case Input.dir4

      when 4 #links

        $pagina -=1

        if $pagina < 0

          $pagina = 0

        end

        $spr.bitmap = Bitmap.new("Graphics/Pictures/bp"+$pagina.to_s)

        sleep(0.3)

      when 6 #rechts

        $pagina +=1

        if $pagina > 10

          $pagina = 10

        end

        $spr.bitmap =Bitmap.new("Graphics/Pictures/bp"+$pagina.to_s)

        sleep(0.3)

    end

  end

end

 

I have 11 pictures named bp0 -> bp10
if you press right, it goes to the next page.

but somehow it does'nt show me the pictures!
and when I press B (escape) it doesn't close either...

please help!
 
You left a couple things out of the update method

Code:
 

  def main

    $spr.bitmap = Bitmap.new("Graphics/Pictures/bp"+$pagina.to_s)

    $spr.x = (640 / 2) - ($spr.bitmap.width / 2)

    $spr.y = (480 / 2) - ($spr.bitmap.height / 2)

    $spr.z = 1000

    Graphics.transition   # Unfreeze the Graphics

    loop do

      Graphics.update

      Input.update

      update

      # Abort loop if screen is changed

      if $scene != self

        break

      end

    end

    $spr.dispose  # dispose the sprite

  end

 
 

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