Delete

Started by Geust, July 08, 2010, 02:00:45 am

Previous topic - Next topic

Geust

July 08, 2010, 02:00:45 am Last Edit: April 01, 2021, 05:37:37 am by earthnite
Thanks.

SBR*

You mean in your own script? It's really easy:
@window.x
or
@window.y
are the x and y coordinates if your windows. Simply add or substract from them. Do this in a loop do, or check for a class variable (it's true when moving, false when not moving) in the update method, and if it's true, let it move. Please remember to dispose your windows when they're out of the screen.

SBR*

July 08, 2010, 03:58:20 pm #2 Last Edit: July 08, 2010, 04:16:07 pm by SBR*
I haven't tested this, but it should work.
code: ShowHide
class Scene_Test
  def initialize(index = 0, return_to = Scene_Map)
    @index = index
    @return_to = return_to
  end
 
  def main
    @window = Window_Command.new(250, ['Quit'])
    @window.x = -@window.width
    Graphics.transition
    #Set window
    loop do
      @window.x += 3
      Graphics.update
      break if @window.x >= 0
    end
    @window.x = 0 #Fix position
    loop do
      Graphics.update
      Input.update
      update
      break if $scene != self
    end
    @window.dispose
  end

  def update
    if @window.active
      @window.update
      if Input.trigger?(Input::B)
        $game_system.se_play($data_system.cancel_se)
        $scene = return_to.new
      end
      if Input.trigger?(Input::C)
        $game_system.se_play($data_system.decision_se)
        case @window.index
        when 0
          $scene = nil
        end
      end
    end
  end
end

SBR*

July 08, 2010, 04:09:50 pm #3 Last Edit: July 08, 2010, 04:16:18 pm by SBR*
Yeah, IK. I typed it in Opera really quickly...

EDIT: Lol. So many mistakes. I'm fixing them now.

EDIT: Fixed.

stripe103


ForeverZer0

Fantasist made a good script for this that was easy to implement into any scene. It's called "Moving Windows" or something like that.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

WhiteRose

Quote from: ForeverZero on July 08, 2010, 09:28:52 pm
Fantasist made a good script for this that was easy to implement into any scene. It's called "Moving Windows" or something like that.

I agree with your suggestion. Here's a link to the topic:
http://forum.chaos-project.com/index.php?topic=83.0
(Now you have no excuse to be lazy and not use it. ;))

SBR*

July 10, 2010, 04:12:16 am #7 Last Edit: July 10, 2010, 02:54:52 pm by SBR*
@window.moving?
to check if moving.

So your new result for the update method, where everything is only updated if not moving, will be:

def update
 @window.update
 if !@window.moving?
   #Update
 end
end


This is because the moving is included in the update method. Unless something else is included in the update method, like in Window_Command, you should use this. But if you manually added something in your own window's update method or used Window_Command, this is your new code:

def update
 if @window.moving?
   @window.move_wins
 else
   #Update
 end
end


EDIT: Duh. Nvm.
loop do
  @window.move_wins
end

SBR*

July 10, 2010, 02:54:16 pm #8 Last Edit: July 11, 2010, 04:02:36 am by SBR*
Oh yeah, duh *slaps himself*.

loop do
 @window.move_wins
  Graphics.update
end


EDIT: I hate myself! Fixed!

SBR*

@actor_command_window.move(@actor_index*160, 480)
loop do
  @actor_command_window.move_wins
  Graphics.update
  break if !@actor_command_window.moving?
end

@actor_command_window.move(640, 480)
loop do
  @actor_command_window.move_wins
  Graphics.update
  break if !@actor_command_window.moving?
end

etc.