i didn't realize you wanted point and click.
i made another quickie based off of the first one, but with point and click instead. theres still a few bugs in it, he pretty much moves to where you click but, if theres an obsticle in his path he wont go around. suprisingly after all these years A* is something i still haven't looked into, supose i should one of these days.
source and resources at
http://www.mediafire.com/download.php?0kctjjmnnfg
Strict
Graphics 800,600
AutoMidHandle(1)
HideMouse
'gfx
Global pointer:TImage = LoadAnimImage("pointer.png",32,32,0,2)
Global map:TImage = LoadImage("map.png")
Global colmap:TImage = LoadImage("colmap.png")
Global player:TImage = LoadAnimImage("player.png",64,64,0,3)
Global target:TImage = LoadImage("target.png")
'var
Global px=400,py=300,pf,pr 'player x, player y, player frame, player rotation
Global ptargetx,ptargety 'target location for the play to walk to
Global markx,marky 'where to place target on the map
Global movex,movey 'place holder for x/y offsets when moving
Global pmoveon=0 'check if player is moving
Global pmovecount 'add a pause to the walk speed
Global pspeed = 5 'how fast the player walks
Global xoffset=540,yoffset=380 'offsets for drawing the map relative to player position
Global pointerframe=0 'which picture for the mouse
Global pointercheck = 0 'check if mouse is over collision map
Global showColON = 0 'toggle view of collision map
Global helpOn = 0 'toggle help
Global helpStartX=200,helpEndX =200 'for help window
Global helpStartY=200,helpEndY =200 'for help window
Global LMapList:TList = New TList
TLevelMap.CreateLevelMap(map,colmap)
While Not KeyDown(key_Escape)
Cls
SetBlend ALPHABLEND
TLevelMap.Update()
If pmoveon = 1
DrawImage target,markx+xoffset,marky+yoffset
pmovecount:+1
If pmovecount = 20 Then pmovecount = 0
If pmovecount = 0
MoveAnim()
MovePlayer()
EndIf
Else
pf = 0
EndIf
SetRotation pr
DrawImage player,px,py,pf
SetRotation 0
pointercheck = TLevelMap.CheckCollision(pointer,pointerframe,0,MouseX(),MouseY())
If pointercheck = 0
pointerframe = 0
If MouseDown(1) Then SetTarget(MouseX(),MouseY())
If MouseDown(2) Then pmoveon = 0
Else
pointerframe = 1
EndIf
DrawImage pointer,MouseX(),MouseY(),pointerframe
If helpOn = 1
If helpStartX > 100 Then OpenHelp()
DrawHelp()
Else
If helpStartX < 200
CloseHelp()
DrawHelp()
EndIf
EndIf
If KeyHit(key_F1)
helpOn:+1
If helpOn > 1 Then helpOn = 0
EndIf
If KeyHit(key_C)
showColOn:+1
If showColOn > 1 Then showColOn = 0
EndIf
SetColor Rand(255),Rand(255),Rand(255)
DrawText "F1 = help",10,580
SetColor 255,255,255
Flip
Wend
ShowMouse
End
Function MoveAnim()
pf:+1
If pf>2 Then pf = 1
EndFunction
Function MovePlayer()
Local x = px
Local y = py
Local movecheck = 0
If ptargetx < movex And ptargety = movey
x:+pspeed
movecheck = TLevelMap.CheckCollision(player,pf,pr,x,y)
If movecheck = 0
pr = 90
movex:-pspeed
xoffset:-pspeed
Else
x:-(pspeed*2)
EndIf
EndIf
If ptargetx > movex And ptargety = movey
x:-pspeed
movecheck = TLevelMap.CheckCollision(player,pf,pr,x,y)
If movecheck = 0
pr = 270
movex:+pspeed
xoffset:+pspeed
Else
x:+(pspeed*2)
EndIf
EndIf
If ptargety < movey And ptargetx = movex
y:-pspeed
movecheck = TLevelMap.CheckCollision(player,pf,pr,x,y)
If movecheck = 0
pr = 180
movey:-pspeed
yoffset:-pspeed
Else
y:+(pspeed*2)
EndIf
EndIf
If ptargety > movey And ptargetx = movex
y:+pspeed
movecheck = TLevelMap.CheckCollision(player,pf,pr,x,y)
If movecheck = 0
pr = 0
movey:+pspeed
yoffset:+pspeed
Else
y:-(pspeed*2)
EndIf
EndIf
If ptargetx > movex And ptargety < movey
x:-pspeed
y:-pspeed
movecheck = TLevelMap.CheckCollision(player,pf,pr,x,y)
If movecheck = 0
pr = 225
movex:+pspeed
xoffset:+pspeed
movey:-pspeed
yoffset:-pspeed
Else
x:+(pspeed*2)
y:+(pspeed*2)
EndIf
EndIf
If ptargetx > movex And ptargety > movey
x:-pspeed
y:+pspeed
movecheck = TLevelMap.CheckCollision(player,pf,pr,x,y)
If movecheck = 0
pr = 315
movex:+pspeed
xoffset:+pspeed
movey:+pspeed
yoffset:+pspeed
Else
x:+(pspeed*2)
y:-(pspeed*2)
EndIf
EndIf
If ptargetx < movex And ptargety < movey
x:+pspeed
y:-pspeed
movecheck = TLevelMap.CheckCollision(player,pf,pr,x,y)
If movecheck = 0
pr = 135
movex:-pspeed
xoffset:-pspeed
movey:-pspeed
yoffset:-pspeed
Else
x:-(pspeed*2)
y:+(pspeed*2)
EndIf
EndIf
If ptargetx < movex And ptargety > movey
x:+pspeed
y:+pspeed
movecheck = TLevelMap.CheckCollision(player,pf,pr,x,y)
If movecheck = 0
pr = 45
movex:-pspeed
xoffset:-pspeed
movey:+pspeed
yoffset:+pspeed
Else
x:-(pspeed*2)
y:-(pspeed*2)
EndIf
EndIf
If movex > ptargetx -10 And movex < ptargetx+10
movex = ptargetx
xoffset = ptargetx
EndIf
If movey > ptargety -10 And movey < ptargety+10
movey = ptargety
yoffset = ptargety
EndIf
If movex = ptargetx And movey = ptargety Then pmoveon = 0
EndFunction
Function SetTarget(xin,yin)
markx = xin-xoffset
marky = yin-yoffset
ptargetx = (px-xin)+xoffset
ptargety = (py-yin)+yoffset
movex = xoffset
movey = yoffset
pmoveon = 1
EndFunction
Function OpenHelp()
helpStartX:-1
helpEndX:+1
helpStartY:-1
helpEndY:+1
EndFunction
Function CloseHelp()
helpStartX:+1
helpEndX:-1
helpStartY:+1
helpEndY:-1
EndFunction
Function DrawHelp()
SetColor 11,11,11
SetAlpha 0.5
DrawRect(helpStartX,helpStartY,helpEndX,helpEndY)
SetAlpha 1
SetColor 255,255,255
If helpStartX = 100
DrawText "Left Mouse button to move",110,130
DrawText "Right Mouse button to stop",110,160
DrawText "C - Toggle show collision map",110,190
EndIf
EndFunction
Type TLevelMap
Field lmap:TImage
Field cmap:TImage
Function CreateLevelMap:TLevelMap(map:Timage,col:Timage)
Local m:TLevelMap = New TlevelMap
m.lmap = map
m.cmap = col
LMapList.AddLast m
EndFunction
Function CheckCollision(image:TImage,frame,rot,xin,yin)
For Local m:TLevelMap = EachIn LMapList
Local x = xoffset+(xin-xoffset)
Local y = yoffset+(yin-yoffset)
If ImagesCollide2(image,x,y,frame,rot,1,1,m.cmap,xoffset,yoffset,0,0,1,1)
Return 1
Else
Return 0
EndIf
Next
EndFunction
Method Draw()
DrawImage Self.lmap,xoffset,yoffset
If showColOn = 1
DrawImage Self.cmap,xoffset,yoffset
EndIf
EndMethod
Function Update()
For Local m:TLevelMap = EachIn LMapList
m.Draw()
Next
EndFunction
EndType
again it's not perfect and not much but i hope it helps somewhat.