The RPG Maker Resource Kit

RMRK RPG Maker Creation => XP => XP Scripts Database => Topic started by: Tsunokiette on September 03, 2006, 06:16:51 PM

Title: Move By Clicking
Post by: Tsunokiette on September 03, 2006, 06:16:51 PM
Here it is, just input these four scripts above main (in order!) -

I edited everything and wrote the Scene_Map addition, the path finder was not done by me, I just removed the SDK dependancy for it because I know you all would flame me if I didn't :P

Just for clarification, once again, the only thing I actualy wrote is the Scene_Map addition. I rewrote the Mouse Coordinates script, but the part of it that makes it work was by Guedez.


Mouse Coordinates -
Code: [Select]
#==================================================================
# GMUS Guedez Mouse Use System
# Version: 1.0
# Released: 26/5/2006 Last Update: 1/6/2006
# Thx to: Cadafalso, Near Fantastica, and some guys from asylum!
# EDITED BY TSUNOKIETTE (to get neccesary parts only)
#==================================================================

$getCursorPos = Win32API.new("user32", "GetCursorPos", ['P'], 'V')

class Mouse_Coordinates
 
  attr_reader :x
  attr_reader :y
 
  def initialize
    @x = get_pos('x')
    @y = get_pos('y')
  end
 
  def update
    @x = get_pos('x')
    @y = get_pos('y')
  end
 
#==============================Thx to: Cadafalso===================
  def get_pos(coord_type)
    lpPoint = " " * 8 # store two LONGs
    $getCursorPos.Call(lpPoint)
    x,y = lpPoint.unpack("LL") # get the actual values
    if coord_type == 'x'
      return x
    elsif coord_type == 'y'
      return y
    end
  end
#==================================================================

end

Input -
Code: [Select]
  #======================================
  # ? Keyboard Script
  #---------------------------------------------------------------------------
  # ?By: Cybersam
  #   Date: 25/05/05
  #   Version 4
  # EDITED BY TSUNOKIETTE (to get neccesary parts only)
  #======================================
 
  module Kboard
   #--------------------------------------------------------------------------
   $RMouse_BUTTON_L = 0x01        # left mouse button
   $RMouse_BUTTON_R = 0x02        # right mouse button
   $RMouse_BUTTON_M = 0x04        # middle mouse button
   $RMouse_BUTTON_4 = 0x05        # 4th mouse button
   $RMouse_BUTTON_5 = 0x06        # 5th mouse button
   #--------------------------------------------------------------------------
   GetKeyState = Win32API.new("user32","GetAsyncKeyState",['i'],'i')
   GetKeyboardState = Win32API.new("user32","GetKeyState",['i'],'i')
   GetSetKeyState = Win32API.new("user32","SetKeyboardState",['i'],'i')
   #--------------------------------------------------------------------------
   module_function
   #--------------------------------------------------------------------------
   def keyb(rkey)
      if GetKeyState.call(rkey) != 0
        return 1
      end
      return 0
   end
    #--------------------------------------------------------------------------
   def keyboard(rkey)
     GetKeyState.call(rkey) & 0x01 == 1  #
   end
   #--------------------------------------------------------------------------
   def key(rkey, key = 0)
     GetKeyboardState.call(rkey) & 0x01 == key #
   end
  end

Path Finder (not done by me) -
Code: [Select]
#==============================================================================
#  Path Finding
#==============================================================================
# Near Fantastica
# Version 1
# 29.11.05
#==============================================================================
# Lets the Player or Event draw a path from an desonation to the source. This
# method is very fast and because the palthfinding is imbeded into the Game
# Character the pathfinding can be inturputed or redrawn at any time.
#==============================================================================
# Player :: $game_player.find_path(x,y)
# Event Script Call :: self.event.find_path(x,y)
# Event Movement Script Call :: self.find_path(x,y)
#-----
# SDK DEPENDANCY REMOVED BY TSUNOKIETTE (SUE ME)
#==============================================================================
  class Game_Character
    #--------------------------------------------------------------------------
    alias nf_pf_game_character_initialize initialize
    alias nf_pf_game_character_update update
    #--------------------------------------------------------------------------
    attr_accessor :map
    attr_accessor :runpath
    #--------------------------------------------------------------------------
    def initialize
      nf_pf_game_character_initialize
      @map = nil
      @runpath = false
    end
    #--------------------------------------------------------------------------
    def update
      run_path if @runpath == true
      nf_pf_game_character_update
    end
    #--------------------------------------------------------------------------
    def run_path
      return if moving?
      step = @map[@x,@y]
      if step == 1
        @map = nil
        @runpath = false
        return
      end
      dir = rand(2)
      case dir
      when 0
        move_right if @map[@x+1,@y] == step - 1 and step != 0
        move_down if @map[@x,@y+1] == step - 1 and step != 0
        move_left if @map[@x-1,@y] == step -1 and step != 0
        move_up if @map[@x,@y-1] == step - 1 and step != 0
      when 1
        move_up if @map[@x,@y-1] == step - 1 and step != 0
        move_left if @map[@x-1,@y] == step -1 and step != 0
        move_down if @map[@x,@y+1] == step - 1 and step != 0
        move_right if @map[@x+1,@y] == step - 1 and step != 0
      end
    end
    #--------------------------------------------------------------------------
    def find_path(x,y)
      sx, sy = @x, @y
      result = setup_map(sx,sy,x,y)
      @runpath = result[0]
      @map = result[1]
      @map[sx,sy] = result[2] if result[2] != nil
    end
    #--------------------------------------------------------------------------
    def clear_path
      @map = nil
      @runpath = false
    end
    #--------------------------------------------------------------------------
    def setup_map(sx,sy,ex,ey)
      map = Table.new($game_map.width, $game_map.height)
      map[ex,ey] = 1
      old_positions = []
      new_positions = []
      old_positions.push([ex, ey])
      depth = 2
      depth.upto(100){|step|
        loop do
          break if old_positions[0] == nil
          x,y = old_positions.shift
          return [true, map, step] if x == sx and y+1 == sy
          if $game_player.passable?(x, y, 2) and map[x,y + 1] == 0
            map[x,y + 1] = step
            new_positions.push([x,y + 1])
          end
          return [true, map, step] if x-1 == sx and y == sy
          if $game_player.passable?(x, y, 4) and map[x - 1,y] == 0
            map[x - 1,y] = step
            new_positions.push([x - 1,y])
          end
          return [true, map, step] if x+1 == sx and y == sy
          if $game_player.passable?(x, y, 6) and map[x + 1,y] == 0
            map[x + 1,y] = step
            new_positions.push([x + 1,y])
          end
          return [true, map, step] if x == sx and y-1 == sy
          if $game_player.passable?(x, y, 8) and map[x,y - 1] == 0
            map[x,y - 1] = step
            new_positions.push([x,y - 1])
          end
        end
        old_positions = new_positions
        new_positions = []
      }
      return [false, nil, nil]
    end
  end
 
  class Game_Map
    #--------------------------------------------------------------------------
    alias pf_game_map_setup setup
    #--------------------------------------------------------------------------
    def setup(map_id)
      pf_game_map_setup(map_id)
      $game_player.clear_path
    end
  end
 
  class Game_Player
    def update_player_movement
      $game_player.clear_path if Input.dir4 != 0
      # Move player in the direction the directional button is being pressed
      case Input.dir4
      when 2
        move_down
      when 4
        move_left
      when 6
        move_right
      when 8
        move_up
      end
    end
  end
 
  class Interpreter
    #--------------------------------------------------------------------------
    def event
      return $game_map.events[@event_id]
    end
  end

Scene_Map Addition (still place above main!) -
Code: [Select]
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs map screen processing.
#==============================================================================

class Scene_Map
  include? Kboard
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  alias main_orig main
  def main
    @mouse_coordinates = Mouse_Coordinates.new
    main_orig
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias update_orig update
  def update
    update_orig
    # Update Mouse Coordinates
    @mouse_coordinates.update
    if Kboard.keyboard($RMouse_BUTTON_L)
      # Get current coordinates
      real_coord_x = @mouse_coordinates.x
      real_coord_y = @mouse_coordinates.y
      # Get column and row
      tile_coord_x = real_coord_x / 32
      tile_coord_y = real_coord_y / 32
      # Get rid of the variance of 8 * 6
      # ( 0 being the origin )
      tile_coord_x -= 8
      tile_coord_y -= 6
      # If Negative Set to 0 for Safety
      tile_coord_x = 0 unless tile_coord_x > -1
      tile_coord_y = 0 unless tile_coord_y > -1
      # Move
      $game_player.find_path(tile_coord_x,tile_coord_y)
    end
  end
end

TRUE credit is in the comments at the top of each script.
Title: Re: Move By Clicking
Post by: Arrow on September 04, 2006, 01:20:24 AM
Wait a minute...Yup, still awesome.
Title: Re: Move By Clicking
Post by: King Anesis on September 04, 2006, 01:21:36 AM
Ok, this script now burns the whole point of Rpg Maker, and makes it a Point-Click Game Maker.
Title: Re: Move By Clicking
Post by: Arrow on September 04, 2006, 01:23:15 AM
I would just use it for a mini game, personally, and I wouldn't think you would want to be limited to one type of game in the first place, so what's the big deal?
Title: Re: Move By Clicking
Post by: King Anesis on September 04, 2006, 01:24:17 AM
Does this script allow you to use both, or just one?
Title: Re: Move By Clicking
Post by: Lord Cloud on September 04, 2006, 04:01:20 AM
it's an excellent script, a stroke of genius, but if you really wanted a point and click game you might as well just use click team. but i give this script a 9/10.
Title: Re: Move By Clicking
Post by: robot797 on September 04, 2006, 07:57:37 AM
eerrrrrrrrr there is one problem the caracter never stopes right on the mouse
Title: Re: Move By Clicking
Post by: Tsunokiette on September 04, 2006, 04:25:10 PM
eerrrrrrrrr there is one problem the caracter never stopes right on the mouse

Here's how to fix it, first replace the Scene_Map addition with this -

Code: [Select]
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs map screen processing.
#==============================================================================

class Scene_Map
  include? Kboard
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  alias main_orig main
  def main
    @mouse_coordinates = Mouse_Coordinates.new
    main_orig
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias update_orig update
  def update
    update_orig
    # Update Mouse Coordinates
    @mouse_coordinates.update
    if Kboard.keyboard($RMouse_BUTTON_R)
      # Get current coordinates
      real_coord_x = @mouse_coordinates.x
      real_coord_y = @mouse_coordinates.y
      # Get column and row
      tile_coord_x = real_coord_x / 32
      tile_coord_y = real_coord_y / 32
      print "Column : [#{tile_coord_x}] Row : [#{tile_coord_y}]"
    end
  end
end

This is what we call a method for testing the script, this is what is going to help us fix your problem.

Next, start a test play, and *obviously* choose new game. Then what you want to do is RIGHT CLICK the top left tile (all the way in the top left corner) and a window will pop up.

It should say something like -

Column : [8] Row : [6]

The numbers in the brackets will be what we call the "variance".

Take note of these numbers.

Now replace the Scene_Map addition with the original found in my first post.

Find this part in it -

Code: [Select]
      # Get rid of the variance of 8 * 6
      # ( 0 being the origin )
      tile_coord_x -= 8
      tile_coord_y -= 6

Replace the top number with the number you got for the column and the bottom number with the number you got for the row.

This should solve your problem.

If it doesn't or you don't understand anything I've said, say so and I'll try to help.

- Tsuno Out
Title: Re: Move By Clicking
Post by: Polraudio on April 26, 2007, 11:52:32 PM
OMG! you don't know how long i been looking for this thank you very much
Title: Re: Move By Clicking
Post by: Kokowam on April 26, 2007, 11:53:16 PM
Necro... Please note the dates the posts were made next time :P
Title: Re: Move By Clicking
Post by: :) on April 26, 2007, 11:54:47 PM
Necro... Please note the dates the posts were made next time :P

?_? xD he was saying he likes teh scripts, nothing wrong with that.
Title: Re: Move By Clicking
Post by: Kokowam on April 27, 2007, 12:02:39 AM
Yeah... But it's just weird when you see posts just popping out and bleh. I guess my train of thought on that stopped there -_- Sorry, Polraudio.
Title: Re: Move By Clicking
Post by: modern algebra on April 27, 2007, 12:31:23 AM
If anything, it was a much needed bump. I never even noticed this before. It's good.
Title: Re: Move By Clicking
Post by: Kokowam on April 27, 2007, 12:37:29 AM
Yeah, I just tested this out. XP Again, gomenaisai.
Title: Re: Move By Clicking
Post by: xinrua on April 27, 2007, 02:26:45 AM
Okay can you make it so it shows a courser. Becuase when I used the script no couser was showed. Please help i looked for this before and none worked so may you make the couser show?
Title: Re: Move By Clicking
Post by: Kokowam on April 27, 2007, 11:04:19 AM
Try moving the mouse around? The mouse is the cursor.
Title: Re: Move By Clicking
Post by: Zelda104 on April 27, 2007, 03:53:07 PM
lol, I recognize the date and all, but while its still being talked about, I pasted the code in and everything works fine. I open my game and go to play and the game crashes. I know its not my computer cause I custom built this thing myself, and its not and old computer. Anyone else had this problem?
Title: Re: Move By Clicking
Post by: Tsunokiette on April 28, 2007, 06:07:09 PM
lol, I recognize the date and all, but while its still being talked about, I pasted the code in and everything works fine. I open my game and go to play and the game crashes. I know its not my computer cause I custom built this thing myself, and its not and old computer. Anyone else had this problem?

What error do you get?
Title: Re: Move By Clicking
Post by: Zelda104 on April 28, 2007, 06:33:15 PM
I get this error message. Like I said, the game just crashes right after I choose, "new game"

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg03.picoodle.com%2Fimg%2Fimg03%2F8%2F4%2F28%2Ff_errorm_bd638ef.png&hash=1f56c2bb5dd963feac6234e1f697ba342970b7d7) (http://www.picoodle.com/view.php?srv=img03&img=/8/4/28/f_errorm_bd638ef.png)
Title: Re: Move By Clicking
Post by: pliio8 on May 01, 2007, 12:31:19 PM
Thats a near-Unfixable problem that results from having PK. I know..I used to use it...yesterday >.>


Ok...I'm getting an error where it dosent move, and when it does...it takes minutes to react...
Title: Re: Move By Clicking
Post by: Kokowam on May 01, 2007, 07:35:18 PM
Ok...I'm getting an error where it dosent move, and when it does...it takes minutes to react...
Lag?
Title: Re: Move By Clicking
Post by: SirJackRex on May 02, 2007, 02:04:12 AM
Hmm...no error for me, but it doesn't even work. Do I have to call the script? I put them in as he said, yet the controls are still the same old arrow keys...  :-\
Title: Re: Move By Clicking
Post by: Tsunokiette on May 03, 2007, 08:08:19 PM
Hmm...no error for me, but it doesn't even work. Do I have to call the script? I put them in as he said, yet the controls are still the same old arrow keys...  :-\

Of course the arrow keys will still work. But try clicking. :/
Title: Re: Move By Clicking
Post by: Kokowam on May 03, 2007, 08:11:58 PM
One question: Can you choose options in menus with the mouse? If so, the arrow keys should be turned off somehow. :P
Title: Re: Move By Clicking
Post by: SirJackRex on May 03, 2007, 08:34:24 PM
Hmm...no error for me, but it doesn't even work. Do I have to call the script? I put them in as he said, yet the controls are still the same old arrow keys...  :-\

Of course the arrow keys will still work. But try clicking. :/

I did, I'm going to go take a shower, I'll try again when I get get back!   :D
Title: Re: Move By Clicking
Post by: Rune on May 08, 2007, 05:26:12 PM
I get the same error... well... not error exactly... the arrow keys work fine... but when I click, nothing happens :-\

[EDIT]
Never mind...
@mexneto - you need to click hard
Title: Re: Move By Clicking
Post by: SirJackRex on May 08, 2007, 06:53:05 PM
Ok! I'll try clicking harder!  :lol:


EDIT: It works, but not too well...
Title: Re: Move By Clicking
Post by: xinrua on July 01, 2007, 10:24:53 PM
ya but it stil has a problem the couser is there but when i click a spot my charecter will not go there it will go some were else. please help.
Title: Re: Move By Clicking
Post by: SirJackRex on July 01, 2007, 10:52:29 PM
ya but it stil has a problem the couser is there but when i click a spot my charecter will not go there it will go some were else. please help.

Yeah, same thing happened to me...
Title: Re: Move By Clicking
Post by: xinrua on July 01, 2007, 11:29:16 PM
so then what do i do?
Title: Re: Move By Clicking
Post by: SirJackRex on July 02, 2007, 12:47:51 AM
so then what do i do?
I don't know, I don't use the script.
Title: Re: Move By Clicking
Post by: firerain on July 02, 2007, 03:08:43 AM
Yarr, this script be fucked up.  :-\
Title: Re: Move By Clicking
Post by: Tsunokiette on July 04, 2007, 02:32:28 AM
Yarr, this script be fucked up.  :-\

Well thank you for saying that. It's not the script. :-\

Let me ask all of you who are getting errors a question :

Are you moving the game window around?
Title: Re: Move By Clicking
Post by: SirJackRex on July 04, 2007, 04:01:47 AM
Naah, same thing happened to me.

No error messages, but when I would click, I would have to click hard, and long, and it wouldn't go in the right direction.
Title: Re: Move By Clicking
Post by: Tsunokiette on July 04, 2007, 07:28:45 PM
What operating system are you using?
Title: Re: Move By Clicking
Post by: SirJackRex on July 04, 2007, 07:31:12 PM
Windows XP.

I can try on Ubuntu later, though.
Title: Re: Move By Clicking
Post by: firerain on July 05, 2007, 05:22:57 PM
Yarr, this script be fucked up.  :-\

Well thank you for saying that. It's not the script. :-\

Let me ask all of you who are getting errors a question :

Are you moving the game window around?
Maybe I was a little to blunt...sorry.
Title: Re: Move By Clicking
Post by: FruitBodyWash on November 04, 2007, 01:49:59 AM
I know this thread hasn't been used in a lil while, but, I have some problems with the code from this specific place so..... I pasted the codes above Main, and go to test it out, and I get an error saying "Syntax error in Mouse_Coordinates: Line 38"  so, I look at the script, and line 38 there is nothing, its just a blank line at the end of the script, so I delete it, thinking, if the game doesn't like it, and I don't need it, it's gone,
but then I get the same error message only this time its line 37, which was
"#=========================================="
so, again I figured, not really a neccisarry line, its just there to help organize, so I erased that as well, only to get....
yet another error message for line... you guessed it, 36! But, line 36 is nessicary, because its one of the  "end" codes, and *shrugs* well, I don't know. I haven't been able to even test it out and see if I would have the same problems a few other people had, or whole new ones, or.... so one and so forth.  Any help, or advice would be appreciated, thanks!
Title: Re: Move By Clicking
Post by: Rune on November 08, 2007, 05:24:28 PM
I understand you need help, and i'm not really the right person to say this, but... try not to necro-post, PM the script 'author' next time if there's a big difference in dates ;)

But... since you've already posted, never mind here :D
Title: Re: Move By Clicking
Post by: modern algebra on November 08, 2007, 06:43:14 PM
Nah, for topics in databases and questions with scripts, you are allowed to necro post for help or congratulations, etc...


In any case, your problem comes from not copying the entire script. I suspect you missed the last line of the script, which says end.


Title: Re: Move By Clicking
Post by: Rune on November 12, 2007, 05:11:21 PM
Nah, for topics in databases and questions with scripts, you are allowed to necro post for help or congratulations, etc...
-.-

Meh, at least you know for outside :-\
Title: Re: Move By Clicking
Post by: patmi on July 30, 2008, 11:39:00 AM
Hi, I got an error :
Script :: Scene_Map_audition line8:NameError Occured.
uninitialized constant Scene_Map :: Kboard


How can this be fixed please?
Title: Re: Move By Clicking
Post by: Tsunokiette on July 31, 2008, 08:08:33 PM
Did you place all of the additions directly above Main? Including the Scene_Map addition?

B/c if you did, then I don't understand why you're getting that error.

If you look at the top of the Scene_Map addition, you'll see this

Code: [Select]
class Scene_Map
  include? Kboard

the

Code: [Select]
  include? Kboard

part makes sure that the script knows what I'm talking about when I say Kboard, and it should be able to use it.

Maybe if you put the scripts into the script editor out of order?
Title: Re: Move By Clicking
Post by: Alpha Vampire17 on July 20, 2009, 11:59:23 PM
Wait a minute...Yup, still awesome.

Every time I put it in the script(And I put it in exact order and everthing) I play the game and try to click move and it freezes and says script hanging? could you tell me what that is a give me a solution to my problem please?
Title: Re: Move By Clicking
Post by: Tsunokiette on August 01, 2009, 07:39:03 PM
It's entirely possible that some computer security stuff is screwing with the script's ability to read user input. It probably thinks it's a keylogger or something lol. To be honest, sometimes scripts just don't work for some people. I'm not entirely sure what the reason is though.
Title: Re: Move By Clicking
Post by: phillip1756 on September 24, 2009, 06:18:27 PM
i find problems with it
Title: Re: Move By Clicking
Post by: Grafikal on September 24, 2009, 11:21:47 PM
post the fucking error. we can't read your mind.
Title: Re: Move By Clicking
Post by: Djeff on October 14, 2009, 07:21:24 PM
ok
it works
but it wont work with someone who will have another screen.
and when i move the screen the rows and columns will change and it will freak out.
Title: Re: Move By Clicking
Post by: ngoaho on January 14, 2010, 02:26:33 PM
hmm, path finder, i have 1 A* path finder, for both 4 & 8 direction, simple but faster than one by near

Code: [Select]
#===============================================================================
# A* Path Finding
# credits: ngoa ho
# http://www.ngoaho.net- ngoaho91@yahoo.com.vn
#===============================================================================
class Path_Finding
  def look_around
    @open_list = []
    for d in [2,4,6,8,1,3,7,9]
      @open_list.push(d) if $game_map.passable?(@curent_node[0],@curent_node[1],d)
    end
    check_black_list
  end
  def go_back_a_node
    @black_list.push(@curent_node)
    @move_list.delete_at(-1)
    @curent_node = @move_list[-1]
  end
  def get_range(dir)
    case dir
    when 1,2,3
      node_y = @curent_node[1] + 1
    when 7,8,9
      node_y = @curent_node[1] - 1
    else
      node_y = @curent_node[1]
    end
    case dir
    when 1,4,7
      node_x = @curent_node[0] - 1
    when 3,6,9
      node_x = @curent_node[0] + 1
    else
      node_x = @curent_node[0]
    end
    x = (@goal_node[0] - node_x).abs
    y = (@goal_node[1] - node_y).abs
    return Math.sqrt(x**2+y**2)
  end
  def check_black_list
    test_node = @curent_node
    for i in 0..@open_list.size - 1
      d = @open_list[i]
      case d
      when 1,2,3
        test_node[1] += 1
      when 7,8,9
        test_node[1] -= 1
      end
      case d
      when 1,4,7
        test_node[0] -= 1
      when 3,6,9
        test_node[0] += 1
      end
      @open_list.delete_at(i) if @black_list.include?(test_node)
    end
  end
  def get_best_node
    min = -1
    best_node = nil
    for i in 0..@open_list.size - 1
      n = get_range(@open_list[i])
      if min == -1
        min = n
        best_node = @open_list[i]
      else
        if n < min
          min = n
          best_node = @open_list[i]
        end
      end
    end
    case best_node
    when 1,2,3
      @curent_node[1] += 1
    when 7,8,9
      @curent_node[1] -= 1
    end
    case best_node
    when 1,4,7
      @curent_node[0] -= 1
    when 3,6,9
      @curent_node[0] += 1
    end
    return best_node
  end
  def find_path(start,goal)
    return [] if start == goal
    # init array
    @start_node = start
    @curent_node = start
    @goal_node = goal
    @black_list = []
    @move_list = []
    # time limit, anti lag
    start_time = Time.now
    limit = $api.read_option("path_finding_time_limit").to_i
    begin
      loop do
        if Time.now - start_time >= limit
          break
        end
        look_around # check surrounding node
        while @open_list == [] and @curent_node != @start_node# if no possible path
          go_back_a_node
          look_around
        end
        @move_list.push(get_best_node)# go to node closet to goal node
        break if @curent_node == @goal_node# find goal node !
      end
    rescue Hangup
      break
    end
    return @move_list
  end
end
add it in main
Code: [Select]
$path_finding = Path_Finding.new
find path like this
Code: [Select]
@paths = $path_finding.find_path([now_x,now_y],[dest_x,dest_y])

** i can't write in unicode