Sorry for the noobish question, but how i use the "Quick Animations" of MACL 2.2.
Actually I wanted to learn how to put an animated image in a window, example:
http://i433.photobucket.com/albums/qq55 ... ns/ss1.png[/img]
Below follows the script "Quick Animations":
Below follows the code of the window "Display":
Now I would like to know where and how should I put the code to display the image animated.
The script has instructions on how you use, but I can not understand.
My attempt failed: :dead:
From now grateful for any help. :thumb:
Actually I wanted to learn how to put an animated image in a window, example:
http://i433.photobucket.com/albums/qq55 ... ns/ss1.png[/img]
Below follows the script "Quick Animations":
#==============================================================================
# ** Systems.Quick Animations (3.01) By SephirothSpawn
#------------------------------------------------------------------------------
# * Description :
#
# This script was designed to act as a GIF animation player. Because GIF
# images aren't actually able to play in RMXP (without API), this script
# either uses a series of images in a directory numbered OR an animation
# like image with multiple frames placed side by side.
#------------------------------------------------------------------------------
# * Instructions :
#
# * Creating Animated Sprite
#
# object = Sprite_Animation.new({<parameters>})
#
# * Creating Animated Plane
#
# object = Plane_Animation.new({<parameters>})
#
# * Parameters
#
# 'type' => 'A' or 'B'
# - Type of Animation (A : Directory of images, B : Spriteset)
# 'loop' => true or false
# - loop (true : loops, false : plays then disposes)
# 'fs' => n
# - frameskip (number of frames to go to next frame)
# 'vp' => Viewport
# - viewport (sprite viewport)
#
# Required For Type A
# 'dir' => 'Graphics/...'
# - directory of images
#
# Required For Type B
# 'frames' => n
# - number of frames on spriteset
# 'bitmap' => 'filename'
# - filename in pictures folder
#------------------------------------------------------------------------------
# * Credits :
#
# Thanks Trickster for Animation Type 2 Suggestion
#==============================================================================
#==============================================================================
# ** Sprite_Animation
#==============================================================================
class Sprite_Animation < Sprite
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(parameters = {})
# Assigns Defaults (If Non-Defined)
@type = parameters.has_key?('type') ? parameters['type'] : 'A'
@loop = parameters.has_key?('loop') ? parameters['loop'] : true
@frameskip = parameters.has_key?('fs') ? parameters['fs'] : 10
@dir = parameters.has_key?('dir') ? parameters['dir'] : nil
@frames = parameters.has_key?('frames') ? parameters['frames'] : 1
viewport = parameters.has_key?('vp') ? parameters['vp'] : nil
bitmap = parameters.has_key?('bitmap') ? parameters['bitmap'] : ''
# Creates Viewport
super(viewport)
# Sets Index
@index = -1
# Sets Specialized Parameters
if @type.upcase == 'B'
# Sets Frame Number & Sets Bitmap
self.bitmap = Cache.picture(bitmap)
end
# Update
update
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
# Stop Unless Proceed Frame
return unless Graphics.frame_count % @frameskip == 0
# Increase Index
@index += 1
# Branch By Type
if @type.upcase == 'A'
# Update Type A
update_type_a
elsif @type.upcase == 'B'
# Update Type B
update_type_b
end
end
#--------------------------------------------------------------------------
# * Frame Update : Type A
#--------------------------------------------------------------------------
def update_type_a
# Begin
begin
# Load Bitmap
self.bitmap = Cache.load_bitmap(@dir, @index.to_s)
# If Bitmap Cannot Be Found
rescue
# If Looping
if @loop
# Reset Index
@index = - 1
update
else
# Dispose Image
self.dispose
end
end
end
#--------------------------------------------------------------------------
# * Frame Update : Type B
#--------------------------------------------------------------------------
def update_type_b
# If Passed Last Frame
if @index == @frames
# If Loop Image
if @loop
# Reset Index & Update Bitmap
@index = -1
update
# If No Loop
else
# Delete Image
self.dispose
return
end
end
# Updates Src Rect
x = (w = self.bitmap.width / @frames) * @index
self.src_rect.set(x, 0, w, self.bitmap.height)
end
end
#==============================================================================
# ** Plane_Animation
#==============================================================================
class Plane_Animation < Plane
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(parameters = {})
# Assigns Defaults (If Non-Defined)
@type = parameters.has_key?('type') ? parameters['type'] : 'A'
@loop = parameters.has_key?('loop') ? parameters['loop'] : true
@frameskip = parameters.has_key?('fs') ? parameters['fs'] : 10
@dir = parameters.has_key?('dir') ? parameters['dir'] : nil
@frames = parameters.has_key?('frames') ? parameters['frames'] : 1
viewport = parameters.has_key?('vp') ? parameters['vp'] : nil
bitmap = parameters.has_key?('bitmap') ? parameters['bitmap'] : ''
# Creates Viewport
super(viewport)
# Sets Index
@index = -1
# Sets Specialized Parameters
if @type.upcase == 'B'
# Sets Frame Number & Sets Bitmap
@_bitmap = Cache.picture(bitmap)
end
# Update
update
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Stop Unless Proceed Frame
return unless Graphics.frame_count % @frameskip == 0
# Increase Index
@index += 1
# Branch By Type
if @type.upcase == 'A'
# Update Type A
update_type_a
elsif @type.upcase == 'B'
# Update Type B
update_type_b
end
end
#--------------------------------------------------------------------------
# * Frame Update : Type A
#--------------------------------------------------------------------------
def update_type_a
# Begin
begin
# Load Bitmap
self.bitmap = Cache.load_bitmap(@dir, @index.to_s)
# If Bitmap Cannot Be Found
rescue
# If Looping
if @loop
# Reset Index
@index = - 1
update
else
# Dispose Image
self.dispose
end
end
end
#--------------------------------------------------------------------------
# * Frame Update : Type B
#--------------------------------------------------------------------------
def update_type_b
# If Passed Last Frame
if @index == @frames
# If Loop Image
if @loop
# Reset Index & Update Bitmap
@index = -1
update
# If No Loop
else
# Delete Image
self.dispose
return
end
end
# Updates Bitmap
b = Bitmap.new((w = @_bitmap.width) / @frames, (h = @_bitmap.height))
b.blt(0, 0, @_bitmap, Rect.new(w / @frames * @index, 0, b.width, h))
self.bitmap = b
end
end
# ** Systems.Quick Animations (3.01) By SephirothSpawn
#------------------------------------------------------------------------------
# * Description :
#
# This script was designed to act as a GIF animation player. Because GIF
# images aren't actually able to play in RMXP (without API), this script
# either uses a series of images in a directory numbered OR an animation
# like image with multiple frames placed side by side.
#------------------------------------------------------------------------------
# * Instructions :
#
# * Creating Animated Sprite
#
# object = Sprite_Animation.new({<parameters>})
#
# * Creating Animated Plane
#
# object = Plane_Animation.new({<parameters>})
#
# * Parameters
#
# 'type' => 'A' or 'B'
# - Type of Animation (A : Directory of images, B : Spriteset)
# 'loop' => true or false
# - loop (true : loops, false : plays then disposes)
# 'fs' => n
# - frameskip (number of frames to go to next frame)
# 'vp' => Viewport
# - viewport (sprite viewport)
#
# Required For Type A
# 'dir' => 'Graphics/...'
# - directory of images
#
# Required For Type B
# 'frames' => n
# - number of frames on spriteset
# 'bitmap' => 'filename'
# - filename in pictures folder
#------------------------------------------------------------------------------
# * Credits :
#
# Thanks Trickster for Animation Type 2 Suggestion
#==============================================================================
#==============================================================================
# ** Sprite_Animation
#==============================================================================
class Sprite_Animation < Sprite
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(parameters = {})
# Assigns Defaults (If Non-Defined)
@type = parameters.has_key?('type') ? parameters['type'] : 'A'
@loop = parameters.has_key?('loop') ? parameters['loop'] : true
@frameskip = parameters.has_key?('fs') ? parameters['fs'] : 10
@dir = parameters.has_key?('dir') ? parameters['dir'] : nil
@frames = parameters.has_key?('frames') ? parameters['frames'] : 1
viewport = parameters.has_key?('vp') ? parameters['vp'] : nil
bitmap = parameters.has_key?('bitmap') ? parameters['bitmap'] : ''
# Creates Viewport
super(viewport)
# Sets Index
@index = -1
# Sets Specialized Parameters
if @type.upcase == 'B'
# Sets Frame Number & Sets Bitmap
self.bitmap = Cache.picture(bitmap)
end
# Update
update
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
# Stop Unless Proceed Frame
return unless Graphics.frame_count % @frameskip == 0
# Increase Index
@index += 1
# Branch By Type
if @type.upcase == 'A'
# Update Type A
update_type_a
elsif @type.upcase == 'B'
# Update Type B
update_type_b
end
end
#--------------------------------------------------------------------------
# * Frame Update : Type A
#--------------------------------------------------------------------------
def update_type_a
# Begin
begin
# Load Bitmap
self.bitmap = Cache.load_bitmap(@dir, @index.to_s)
# If Bitmap Cannot Be Found
rescue
# If Looping
if @loop
# Reset Index
@index = - 1
update
else
# Dispose Image
self.dispose
end
end
end
#--------------------------------------------------------------------------
# * Frame Update : Type B
#--------------------------------------------------------------------------
def update_type_b
# If Passed Last Frame
if @index == @frames
# If Loop Image
if @loop
# Reset Index & Update Bitmap
@index = -1
update
# If No Loop
else
# Delete Image
self.dispose
return
end
end
# Updates Src Rect
x = (w = self.bitmap.width / @frames) * @index
self.src_rect.set(x, 0, w, self.bitmap.height)
end
end
#==============================================================================
# ** Plane_Animation
#==============================================================================
class Plane_Animation < Plane
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(parameters = {})
# Assigns Defaults (If Non-Defined)
@type = parameters.has_key?('type') ? parameters['type'] : 'A'
@loop = parameters.has_key?('loop') ? parameters['loop'] : true
@frameskip = parameters.has_key?('fs') ? parameters['fs'] : 10
@dir = parameters.has_key?('dir') ? parameters['dir'] : nil
@frames = parameters.has_key?('frames') ? parameters['frames'] : 1
viewport = parameters.has_key?('vp') ? parameters['vp'] : nil
bitmap = parameters.has_key?('bitmap') ? parameters['bitmap'] : ''
# Creates Viewport
super(viewport)
# Sets Index
@index = -1
# Sets Specialized Parameters
if @type.upcase == 'B'
# Sets Frame Number & Sets Bitmap
@_bitmap = Cache.picture(bitmap)
end
# Update
update
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Stop Unless Proceed Frame
return unless Graphics.frame_count % @frameskip == 0
# Increase Index
@index += 1
# Branch By Type
if @type.upcase == 'A'
# Update Type A
update_type_a
elsif @type.upcase == 'B'
# Update Type B
update_type_b
end
end
#--------------------------------------------------------------------------
# * Frame Update : Type A
#--------------------------------------------------------------------------
def update_type_a
# Begin
begin
# Load Bitmap
self.bitmap = Cache.load_bitmap(@dir, @index.to_s)
# If Bitmap Cannot Be Found
rescue
# If Looping
if @loop
# Reset Index
@index = - 1
update
else
# Dispose Image
self.dispose
end
end
end
#--------------------------------------------------------------------------
# * Frame Update : Type B
#--------------------------------------------------------------------------
def update_type_b
# If Passed Last Frame
if @index == @frames
# If Loop Image
if @loop
# Reset Index & Update Bitmap
@index = -1
update
# If No Loop
else
# Delete Image
self.dispose
return
end
end
# Updates Bitmap
b = Bitmap.new((w = @_bitmap.width) / @frames, (h = @_bitmap.height))
b.blt(0, 0, @_bitmap, Rect.new(w / @frames * @index, 0, b.width, h))
self.bitmap = b
end
end
Below follows the code of the window "Display":
#######################################################################
class Window_Display < Window_Base
def initialize(x, y)
super (x, y, 544, 150)
refresh
end
def refresh
self.contents.clear
draw_face("Actor1", 0, 0, 0, size = 96)
self.contents.draw_text(97, 0, 100, WLH, "Aqui segue uma demo")
self.contents.draw_text(97, 0, 100, WLH + 36, "de como fazer ")
end
end
#######################################################################
class Window_Display < Window_Base
def initialize(x, y)
super (x, y, 544, 150)
refresh
end
def refresh
self.contents.clear
draw_face("Actor1", 0, 0, 0, size = 96)
self.contents.draw_text(97, 0, 100, WLH, "Aqui segue uma demo")
self.contents.draw_text(97, 0, 100, WLH + 36, "de como fazer ")
end
end
#######################################################################
Now I would like to know where and how should I put the code to display the image animated.
The script has instructions on how you use, but I can not understand.
My attempt failed: :dead:
#######################################################################
self.contents.clear
@viewport = Viewport.new(0, 0, 544, 416)
bitmap = Sprite_Animation.new('type' = {'A'}, 'loop' = {true}, 'fs' = {0}, 'dir' = {'Graphics/teste'},'vp' = {@viewport})
cw = bitmap.width
ch = bitmap.height
# Bitmap Rectange
src_rect = Rect.new(0, 0, cw, ch)
# Draws Bitmap
self.contents.blt(0, 0, bitmap, src_rect)
draw_face("Actor1", 0, 0, 0, size = 96)
self.contents.draw_text(97, 0, 100, WLH, "Aqui segue uma demo")
self.contents.draw_text(97, 0, 100, WLH + 36, "de como fazer ")
######################################################################
self.contents.clear
@viewport = Viewport.new(0, 0, 544, 416)
bitmap = Sprite_Animation.new('type' = {'A'}, 'loop' = {true}, 'fs' = {0}, 'dir' = {'Graphics/teste'},'vp' = {@viewport})
cw = bitmap.width
ch = bitmap.height
# Bitmap Rectange
src_rect = Rect.new(0, 0, cw, ch)
# Draws Bitmap
self.contents.blt(0, 0, bitmap, src_rect)
draw_face("Actor1", 0, 0, 0, size = 96)
self.contents.draw_text(97, 0, 100, WLH, "Aqui segue uma demo")
self.contents.draw_text(97, 0, 100, WLH + 36, "de como fazer ")
######################################################################
From now grateful for any help. :thumb: