Sign in to follow this  
Followers 0
edugonrod

Insertar video

5 posts in this topic

Tienes que crear un nuevo script justo encima de la clase Main :

CODE

Code:

#==============================================================================
# ? MoviePlayer Module v0.5
#------------------------------------------------------------------------------
# By: dgam3z
# Date: 18/10/04
#==============================================================================

module MoviePlayer

#--------------------------------------------------------------------------
# ? The attr_acessor for those pretty functions this mod has.
#-------------------------------------------------------------------------
class<<self
attr_accessor(:X,:y,:z,:width,:height,:opacity)
end

#--------------------------------------------------------------------------
# ? Initialize the constants.
#-------------------------------------------------------------------------
MULTIFILE = 1
ONEFILE = 2

#--------------------------------------------------------------------------
# ? Initialize.
#-------------------------------------------------------------------------

@loaded = false

#--------------------------------------------------------------------------
# ? Loads the file(s).
# In: name, frames, @loaded
# Out: @rmm_name, @rmm_type, @rmm_width, @rmm_height, @loaded, @rmm_frames
#-------------------------------------------------------------------------
def self.load(name,frames=0)
if not @loaded then
#Checks if the movie is ONEFILE.
if FileTest.exists?("Movies/"+name+".png") then
if frames != 0
@rmm_frames = frames
else
if $DEBUG then print "Debug: Number of frames needed for this movie." end
return 3 #Error 3: Need the number of frames.
end

@rmm = Sprite.new
@rmm_name = name
@rmm_type = ONEFILE
@rmm_x = 0
@rmm_y = 0
@rmm_z = 4000
@rmm_width = 0
@rmm_height = 0
@frame_counter = 0

#Checks the size of the file.
@rmm_width = Bitmap.new("Movies/"+@rmm_name+".png").width/@rmm_frames
@rmm_height = Bitmap.new("Movies/"+@rmm_name+".png").height
@loaded = true
return 0 #No Errors: Everything wen't fine.
end
#Checks if the movie is MULTIFILE.
if FileTest.exists?("Movies/"+name+"/"+name+"_0.png") then

@rmm = Sprite.new
@rmm_name = name
@rmm_type = MULTIFILE
@rmm_frames = 0
@rmm_x = 0
@rmm_y = 0
@rmm_z = 4000
@rmm_width = 0
@rmm_height = 0
@frame_counter = 0

#Checks the size of the file.
@rmm_width = Bitmap.new("Movies/"+@rmm_name+"/"+@rmm_name+"_0.png").width
@rmm_height = Bitmap.new("Movies/"+@rmm_name+"/"+@rmm_name+"_0.png").height

i = 0
while FileTest.exist?("Movies/"+@rmm_name+"/"+@rmm_name+"_#{i}.png")
i = i + 1
end
#And get the number of frames.
@rmm_frames = i - 1
@loaded = true
return 0 #No Errors: Everything wen't fine.
end
if $DEBUG then print "Debug: File not found." end
return 2 #Error 2: File not found.
end
if $DEBUG then print "Debug: Last movie not unloaded." end
return 1 #Error 1: Needs to unload last movie first.
end

#--------------------------------------------------------------------------
# ? Starts a movie.
#-------------------------------------------------------------------------
def self.start(trans=40)
if not @loaded then
if $DEBUG then print "Debug: Can't start, movie not loaded." end
return 1 #Error 1: Not loaded.
end

Graphics.freeze

if @rmm_type == ONEFILE then
@rmm.bitmap = Bitmap.new("Movies/"+@rmm_name+".png")
@rmm.src_rect.set(@rmm_width*@frame_counter, 0, @rmm_width, @rmm_height)
end

if @rmm_type == MULTIFILE then
@rmm.bitmap = Bitmap.new("Movies/"+@rmm_name+"/"+@rmm_name+"_0.png")
@rmm.src_rect.set(0, 0, @rmm.bitmap.width, @rmm.bitmap.height)
end

@frame_counter = 1

#Makes the transition.
Graphics.transition(trans)
end

#--------------------------------------------------------------------------
# ? Updates the movie. (changes to the next frame)
#-------------------------------------------------------------------------
def self.update
if @loaded == true then
if @rmm_type == ONEFILE then
@rmm.src_rect.set(@rmm_width*@frame_counter, 0, @rmm_width, @rmm_height)
end
if @rmm_type == MULTIFILE then
@rmm.bitmap = Bitmap.new("Movies/"+@rmm_name+"/"+@rmm_name+"_#{@frame_counter}.png")
@rmm.src_rect.set(0, 0, @rmm.bitmap.width, @rmm.bitmap.height)
end
Graphics.update
@frame_counter = @frame_counter + 1
if @frame_counter == @rmm_frames
@frame_counter = 0
return true
else
return false
end
end
end


#--------------------------------------------------------------------------
# ? Sets and retrieves the movie coordinates.
#-------------------------------------------------------------------------
def self.x; return @rmm.x; end
def self.x=(tx); @rmm.x = tx; end
def self.y; return @rmm.y; end
def self.y=(ty); @rmm.y = ty; end
def self.z; return @rmm.z; end
def self.z=(tz); @rmm.z = tz; end

#--------------------------------------------------------------------------
# ? Retrieves the movie size.
#-------------------------------------------------------------------------
def self.width; return @rmm_width; end
def self.height; return @rmm_height; end

#--------------------------------------------------------------------------
# ? Sets and retrieves the movie opacity.
#-------------------------------------------------------------------------
def self.opacity; return @rmm.opacity; end
def self.opacity=(topacity); @rmm.opacity = topacity; end

#--------------------------------------------------------------------------
# ? Checks if a movie is loaded.
#-------------------------------------------------------------------------
def self.loaded?
return @loaded
end

#--------------------------------------------------------------------------
# ? Returns the in which frame is the movie now.
#-------------------------------------------------------------------------
def self.frame?
if @loaded then
return @frame_counter
end
end

#--------------------------------------------------------------------------
# ? Easy Definition to play movies (aka Newbie Definition).
#-------------------------------------------------------------------------
def self.play(movie, loops=1, wait=2, trans=0, x=nil, y=nil, z=4000, opacity=255)
MoviePlayer.load(movie)
if x != nil then MoviePlayer.x = x; else MoviePlayer.x = 320 - @rmm_width/2; end
if y != nil then MoviePlayer.y = y; else MoviePlayer.y = 240 - @rmm_height/2; end
MoviePlayer.z = z
MoviePlayer.start(trans)
for i in 1..loops
begin
for i in 0..wait
Graphics.update
end
end while MoviePlayer.update == false
end
MoviePlayer.stop(trans)
end

#--------------------------------------------------------------------------
# ? Stops and unloads the movie.
#-------------------------------------------------------------------------
def self.stop(trans=40)
if not @loaded then
if $DEBUG then print "Debug: Can't stop, movie not loaded." end
return 1 #Error 1: Not loaded.
end

Graphics.freeze

@rmm.bitmap.dispose

@loaded = false

#Makes the transition.
Graphics.transition(trans)
end
end



Como usarlo
Para la gente que no conoce nada sobre rgss y quiere poner una animación, esta definición.

Code:

MoviePlayer.play(movie, loops, wait, trans, x, y, z, opacity)



> movie: The file to play, must be inside the "movies" directory.
> loops: How many times you want to play the animation. Default: 1
> wait: The number of dummy frames to wait between frames. Default: 2
> trans: The frames that the transition before and after the animation takes. Default: 40
> x,y,z: The location of the animation on the screen. Default: Center on the screen and z=4000
> opacity: The opacity of the animation.

Then there is those advanced definitions and properties. Después aqui están las propiedades y las definiciones avanzadas.
MoviePlayer.load(movie, frames)
Loads the movie. "movie" is the movie to load and "frames" is the number of frames that the movie has, "frames" can only be used by those animation on one file. There are plenty of returns on this definition for each error, please check the comments.
MoviePlayer.start(trans)
Here the movie starts, "trans" is the frames that the transition takes.
MoviePlayer.update
This updates the movie to next frame, returns "true" when reaches the last frame.
MoviePlayer.stop(trans)
This makes the movie stop, "trans" is the frames that the transition takes.

MoviePlayer.x and MoviePlayer.y and MoviePlayer.z
These properties sets the movie coordinates on the screen, this can be changed while the animation is playing.

MoviePlayer.width and MoviePlayer.height
Read only properties that return the size of the animation.

MoviePlayer.frame?
Returns in which frame is the animation.

MoviePlayer.loaded?
Returns true if a movie is loaded






Lo poco que hay traducido lo tradujo Pickspy
0

Share this post


Link to post
Share on other sites
nunca e podido usar este script siempre me da error llorar.gif
0

Share this post


Link to post
Share on other sites
Hey deja de responder a temas viejos que llevan mas de un mes cabreado.gif
avusas de tu poder cabreado.gif Edited by sabin
0

Share this post


Link to post
Share on other sites
Y ahora te digo yo sabin, deja de pseudomoderar sino vas a opinar del tema. ya yo le avise por PM hace horas. Te llevas warn por pseudomoderar y no escribir nada relacionado al tema. Tu te lo "buscaste" que te lo suba.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0