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.

[Resolved] Adding music to a script?

Status
Not open for further replies.
Well... i got a script for showing a image before the title screen

This is the script:

###############################################################################
######Script that show a image before the title screen ######
###############################################################################
#
# Autor: Hyruleoflink
#
# Version: Beta 1.0
#
###############################################################################

begin
@logo = Sprite.new
@logo.bitmap = RPG::Cache.picture("logo")
Graphics.freeze
Graphics.transition(50)
@logo = nil
end

-----------------------------------------------------------------------

Well i want to add a music that show whit the script... like this a think:

@music.mp3 = RPG::Cache.music("music.mp3")

Something like that that run music whit the image script

Anyone can help me?

Darkkurama
 
Here ya go:
Code:
################################################## #############################
#
# Autor: Hyruleoflink 
#
# Version: Beta 1.0
#
################################################## #############################

begin
  BGM = "FILENAME"
  Audio.bgm_play("Audio/BGM/" + BGM, 100, 100)
  @logo = Sprite.new
  @logo.bitmap = RPG::Cache.picture("logo")
  Graphics.freeze
  Graphics.transition(50)
  Audio.bgm_stop
  @logo = nil
end
Change FILENAME to the name of the music you want to use. I'd also suggest changing the transition time so the music has time to play.
 
I am sorry, but may I cringe at this code for a minute? For one, it is just... wow. All it is a sprite being displayed with the Graphics.transition effect, which should just never happen. Then the sprite itself isn't even disposed, just changed to nil, and just lets the GarbageCollect take care of everything. This should be considered as an "expierement in scripting", not a script.

Anyways, unless you stuck on using this, I would try my Introduction & Splash System or Lamchop's. Either would be 10x better than this.
 
Well Thanx sithlord999! you RoX!

SephirothSpawn, i know you are the king of scripts, but why u say you got the best script and its better than mine? what do that comment on this post??...

Anyway... Thanx!

Darkkurama
 
He doesn't attack you, he just point you to scripts that will induce less memory consumption than yours.

OTOH, Seph, RPG::Cache elements shoudn't be disposed. The problem is using the cache in the first place >_<

Ah, and I didn't know you could display sprites that way :D
 
I am sorry darkkurama. I didn't mean to offend you.

A) I didn't know you were "Hyruleoflink"
B)
This should be considered as an "expierement in scripting"
C)
but why u say you got the best script and its better than mine?
I didn't. I recommended using my script and I also recommended using lamchop's. I would say the same if Scripter A did a better version of a script. It is my nature. If you haven't noticed, Trickster, myself, Rataime and others don't go around saying "USE MY SCRIPT!" We do however go around giving advice on how to improve scripts, either by example or breaking apart people syntax (as I did in my post) and explain a better way of doing things.

Again, sorry if I offened you.

@Rataime : Hehe. I am with you. I understand not to dispose the bitmap, but the sprite should be. I wonder how many times I have created caches in my scripts to save on loading time as well...

This topic has been resolved. If darkkurama or any other users have any questions or further problems regarding this topic, please create a new thread about them.

Thank you!
 
Status
Not open for further replies.

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