Seite 3 von 3 ErsteErste 123
Ergebnis 41 bis 44 von 44

Thema: Welchen Maker nutzen?

  1. #41
    @Dani:

    <Klick mich!> =D BTW: Muss mich verbessern ^^ Das Script ist nicht bei rpg-xp.com zu finden, sondern bei rpg-xp.de ^^
    Yours,

    Angelus

  2. #42
    Ich danke dir, aber da ist anscheinend ja noch recht wenig gemacht..^^. Inzwischen hab ich herausgefunden, dass der Link in der FAQ nicht geschrottet war, sondern das Forensystem(des gelinkten Forums) nur kein Direktes linken von Threads unterstützt (oder so ähnlich). Darum werde ich es hier nochmal posten und diesen post direkt in die FAQ verlinken ^^. So haben wir einen Platz für den code und du bekommst exklusiv die "bessere" Variante :>.

    Zitat Zitat
    Movie Player v0.5

    General Ideia
    Here it is, version 0.5 (and maybe final) of the movieplayer script.
    This script will allow you to play animations using images on your rpg, this is the best alternative because rmxp can't play movies (yet).

    Changes
    > The code was optimized since 0.4
    > Added some new definitions to the module.
    > Added a comment to each definition.
    > Added the newbie definition for those who don't know ruby very well.

    Install
    Just paste the next code on a new page (you can call it "Module_MoviePlayer" for example):

    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

    How to use
    For the people that don't know almost nothing about rgss and just want to play a animation i made this definition:

    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.
    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.

    Credits
    Coder: dgam3z (dg3zsoft ceo )
    Ideias from:
    dubealex (http://rmxp.dubealex.com)
    Missy (trust me, you helped me)
    X-RPG Forum in general for helping me with minor problems. (search ownz you)
    Translated Japanese Help file (http://postality-knights.no-ip.org/R...bel/index.html)
    And everyone else that supported and helped me with this script.
    Thank you.

    Another News
    Now its time for... multiplayer! Let me see what can i do with this.
    Im also checking the game.exe asm code... there is always nice stuff in there to change.

  3. #43
    @Dani:
    Hey, cool. THX =P
    Aber welche Dateiformate werden denn nun unterstützt? Auch nur AVI? Wäre
    ziemlich speicherlastig...
    Yours,

    Angelus

  4. #44
    Zitat Zitat von angelus
    @Dani:
    Hey, cool. THX =P
    Aber welche Dateiformate werden denn nun unterstützt? Auch nur AVI? Wäre
    ziemlich speicherlastig...
    Yours,

    Angelus

    Ich hab mir das ganze genauer angeschaut und es sieht aus, als müsstest du einzelne Pics deines Videos in einen Ordner packen und der Maker verwandelt das ganze in einen Film..^^´ wahrscheinlich werden die "Videos" dadurch kleiner. (pics kann man ja stark komprimieren)

    Also ist das Script von Andreas doch ganz nützlich, wenn man avi files abspielen will (verbraucht halt mehr speicher, ist aber wohl ..einfacher ^^). Ich pack am besten beides in die FAQ. Gut, dass du nachgefragt hast.

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •