point and click movement

is there a code for blender 2.5 GE that can move a character in a point and click manner like runescape?

This is my code so far but i never works properly(in the pathfinder 2 attachment):

import bge
GameLogic = bge.logic
from Rasterizer import *

showMouse(1) #show cursor

cont=GameLogic.getCurrentController()
own=cont.owner
Sens = cont.sensors
Sensor = Sens[0]

mouse = cont.sensors[“mouse”]
left=cont.sensors[“left”]
getobj=GameLogic.getCurrentScene().objects

target=mouse.raySource
hitpos=mouse.position

Height = getWindowHeight()/2
Width = getWindowWidth()/2

get current mouse position

Xpos = Sensor.position.x
Ypos = Sensor.position.y

own.position.x = Xpos
own.position.y = Ypos

empty=getobj[“Track”]
scout=getobj[“PlayerObj”]

if (left.positive):
empty.position = own.position

can anyone fix it or give another solution?

thanks, bearmey

I posted two blend files. these are my two attempts at this.

Attachments

pathfinder2.blend (243 KB)following ai10.blend (368 KB)

Firstly, in future i recommend you post code in code tags (go advanced, or type [ CODE ] at start, and [ /CODE ] at the end).

Secondly, check my file here:
http://blenderarchive.hostilestudios.com/list.php

look at RTS flag demo