Erratum: I meant I wanted to move
the image with @img.move
(duration, origin, x, y, zoom_x, zoom_y, opacity, blend_type) instead of @img.show
(duration, origin, x, y, zoom_x, zoom_y, opacity, blend_type)
Indeed, I've already increased the wait command. Unfortunately, doing so renders things even more strange:
which, upon testing, makes (in temporal order): Pic displayed => waiting => print statement => Pic moving
In fact, I want to do a custom picture menu myself
: with the current map as a background and a picture appearing by moving towards a definite position. So I've rewritten the Scene_Menu class. While testing, everything is OK except the fact that the picture moves only
when I leave the menu.
, hence i've taken the print command as a test for next commands.
Basically, my stuff is something like this:
@spriteset = Spriteset_Map.new # to display the current map as background
@picture_n1 = Game_Picture.new
show @picture_n1 (initial co-ordinates, initial size)
@picture_n1 = $game_screen.pictures
move @picture_n1 (to new co-ordinates, new size, duration)
#after movement completed=>
if $scene != self
$scene = Scene_Map.new
================== E D I T ================================
After days of pondering on the scripts of RGSS classes, I've finally found the solution.
Obviously, the key thing is movement duration. In classic event commands, one could easily precise how long the movement lasts in number of frames.
Well... in RGSS language, this duration is a variable that may be found in Game_Picture class as @duration
. What one must do is making the script check if the movement completion before
executing to the next command, in other words checking if @image.duration = 0
one cannot read this variable in this script, and RGSS returns an undefined method error.
So, going back to Game_Picture class, attr_reader :duration
must be indicated at the beginning.
Consequently, the script for moving a picture might looks like this:
@img = Game_Picture.new(1)
@img = $game_screen.pictures
@img.show(name, origin, x, y, zoom_x, zoom_y, opacity, blender_type)
@img.move(duration, origin, x, y, zoom_x, zoom_y, opacity, blender_type)
loop do # loop for checking the value of @img.duration, as long as it's > 0, the script keeps on updating the pic
if @img.duration == 0
#insert [i]wait command[/i] here#
print "hello world!"
Now, each command appears at the right time!
This post has been edited by Ganon77: May 24 2012, 04:53 PM