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.

Displaying bitmaps/Opening credits help :S

Hello all!

So I just spent the past 2 hours reading script and trying to figure it out. In short, it seems to be pretty intuitive - I know nothing of scripting and writing code, but I'm a quick learner and learned how to modify/edit codes to fit my needs. Simple things. nothing major. It's really neat to see how the game engine handles data and displays things for us when we're playing biggrin.gif

I've come to the conclusion that I need to write a script to display some opening title sequences. Here is what I've deduced:
- First the game loads all of the tiles and characters, and a bunch of other things
- It then creates the title screen (loads the image you've selected in the system settings)
- Then it creates the dialogue box (new game, continue, shutdown)

So what I'm trying to do now is to display a couple of images before the engine initializes the title screen. Noobiness aside, I would like to "display image 1, "wait 60 frames," "display image 2," "wait 60 seconds," "display title screen."

I've come across some coding phrases, and I think this is what I should be posting to display an image:
Code:
#--------------------------------------------------------------------------

  # * Load Bitmap

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

  def self.load_bitmap(folder_name, filename, hue = 0)

    @cache = {} if @cache == nil

    path = folder_name + filename

    if not @cache.include?(path) or @cache[path].disposed?

      if filename.empty?

        @cache[path] = Bitmap.new(32, 32)

      else

        @cache[path] = Bitmap.new(path)

      end

    end

    if hue == 0

      return @cache[path]

    else

      key = [path, hue]

      if not @cache.include?(key) or @cache[key].disposed?

        @cache[key] = @cache[path].clone

        @cache[key].hue_change(hue)

      end

      return @cache[key]

    end

  end

end

 


But I don't fully understand how to use it. I also can't find any codes or whatnot that makes the system pause for a certain amount of time other than

Code:
 

# Execute transition

Graphics.transition

 

I'm fully aware that the above code doesn't cause a pause in the flow, but it DOES change graphics. I've "frankencoded" a small bit to see what happens, and the above code has worked pretty good.

Now I'm stuck. To summarize: How do I straight up insert an image file from a directory on my computer? Is this, the insertion of a couple of images before the title screen, the best way to go about acheiving the effect I want? How do you pause the data stream, i.e. how do I pause the flow long enough for people to look at the images while playing my game?

Coding is fun! I've learned how to do simple things tonight, but I'm no coder, and I just need a push in the right direction!

Thanks alot!

~Drewz
 
From what I understand, You want a scene to be showed before Scene_Title.

I


How do I straight up insert an image file from a directory on my computer?

variable = Sprite.new
variable.bitmap = RPG::Cache.picture("Image 1")

That's the easiest way I know. it will search inside your "picture" folder for an Image called "Image 1"

how do I pause the flow long enough for people to look at the images while playing my game?

time_variable = 60
Graphics.transition
while $scene == self
Graphics.update
if time_variable > 0 then time_variable -=1
redo end

This will set a time of 60 frames, and reduce frame by frame. When it reaches 0, it will break and continue with the next lines of script.

II


Since "Main" holds the beginning of the game, you should modify it.


At Scene_Title You have this:

Code:
 

    $data_actors        = load_data("Data/Actors.rxdata")

    $data_classes       = load_data("Data/Classes.rxdata")

    $data_skills        = load_data("Data/Skills.rxdata")

    $data_items         = load_data("Data/Items.rxdata")

    $data_weapons       = load_data("Data/Weapons.rxdata")

    $data_armors        = load_data("Data/Armors.rxdata")

    $data_enemies       = load_data("Data/Enemies.rxdata")

    $data_troops        = load_data("Data/Troops.rxdata")

    $data_states        = load_data("Data/States.rxdata")

    $data_animations    = load_data("Data/Animations.rxdata")

    $data_tilesets      = load_data("Data/Tilesets.rxdata")

    $data_common_events = load_data("Data/CommonEvents.rxdata")

    $data_system        = load_data("Data/System.rxdata")

 

This lines of code load the necessary info to start the game, and they are the ones you talk about on your post.

Create a Scene with the images at the beginning:

Code:
 

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

class Scene_First

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

def main

    $data_actors        = load_data("Data/Actors.rxdata")

    $data_classes       = load_data("Data/Classes.rxdata")

    $data_skills        = load_data("Data/Skills.rxdata")

    $data_items         = load_data("Data/Items.rxdata")

    $data_weapons       = load_data("Data/Weapons.rxdata")

    $data_armors        = load_data("Data/Armors.rxdata")

    $data_enemies       = load_data("Data/Enemies.rxdata")

    $data_troops        = load_data("Data/Troops.rxdata")

    $data_states        = load_data("Data/States.rxdata")

    $data_animations    = load_data("Data/Animations.rxdata")

    $data_tilesets      = load_data("Data/Tilesets.rxdata")

    $data_common_events = load_data("Data/CommonEvents.rxdata")

    $data_system        = load_data("Data/System.rxdata")

  bit1 = Sprite.new

  bit1.bitmap = RPG::Cache.picture("Image 1")

  time = 60

  Graphics.transition(1)

  while $scene == self

    Graphics.update

    if time > 0 then time-=1

      redo end

    if bit1.opacity > 0 then bit1.opacity -= 3

      redo end

        bit1 = Sprite.new

  bit1.bitmap = RPG::Cache.picture("Image 2")

  time = 60

  Graphics.transition

  while $scene == self

    Graphics.update

    if time > 0 then time-=1

      redo end

    if bit1.opacity > 0 then bit1.opacity -= 2

      redo end

      $scene = Scene_Title.new

  end

  Graphics.freeze

  bit1.dispose

end

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

end

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

end

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

 

then, go to Main, and where it says:

$scene = Scene_Title.new

replace for

$scene = Scene_First.new

That should show 2 images before showing the Title Screen.
If you don't understand something, just ask.

P.S: Sorry but I suck at explaining stuff, and I'm not a good scripter, so if there's something wrong, please comment.
 
Holy frak, people! Thanks alot for the extremely quick reply! Right now, I'm working on weapon icons, and I'm not scripting yet. However, I'll soon get bored of this, and then I'll start trying out these fancy scripts. Thank you so much :D

I posted this exact question verbatim on another website, and no one has replied to it. That was a week ago.

edit: works fantastic. I can't believe how awesome you are. Welcome to my credits page, Fallen :D
 

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