Attached the little lengthy code. I used image and form lib.
It is fast enough when run on PC but slow on PPC.
Here is the key code:
sub repaint
' handle mapwin move
if mapwin.moved = 1 then
'erase all sp
for ii = 0 to spcnt - 1
sphide(ii)
next
' redraw mapwin
mapwin.x = min(bmpmap.Width - mapwin.w, max(0, mapwin.x + mapwin.dx) )
mapwin.y = min(bmpmap.Height - mapwin.h, max(0, mapwin.y + mapwin.dy) )
rectsrc.x = mapwin.x
rectsrc.Y = mapwin.y
rectsrc.Width = mapwin.w
rectsrc.Height = mapwin.h
rectdst.X = mapscr.x
rectdst.y = mapscr.y
rectdst.width = mapscr.w
rectdst.height = mapscr.h
drawerb.DrawImage1(bmpmap.Value, rectsrc.Value, rectdst.Value, true)
drawerb.Refresh2(rectdst.Value)
mapwin.moved = 0
mapwin.dx = 0
mapwin.dy = 0
form1.Line(10, 10, 60, 60, cRed, B)
for ii = 0 to spcnt - 1
spshow(ii)
next
end if
' handle sp move
for ii = 0 to spcnt - 1
if spmap(ii).moved = 1 and ii <> spselected then
spmove(ii)
end if
next
end sub
sub spshow(nsp)
if spinwin(nsp) then
rectsrcs.X = 50 * spmap(nsp).pg
rectsrcs.Y = 0
rectsrcs.Width = spmap(nsp).w
rectsrcs.Height = spmap(nsp).h
rectdsts.X = scrx(spmap(nsp).x)
rectdsts.Y = scry(spmap(nsp).y)
rectdsts.Width = spmap(nsp).w
rectdsts.Height = spmap(nsp).h
drawerf.DrawImage1(bmpsprite.Value, rectsrcs.Value, rectdsts.Value, true)
drawerf.Refresh2(rectdsts.Value)
end if
end sub
sub sphide(nsp)
'erase original image on screen
rectdsts.X = scrx(spmap(nsp).x)
rectdsts.Y = scry(spmap(nsp).y)
rectdsts.Width = spmap(nsp).w
rectdsts.Height = spmap(nsp).h
drawerf.fillrectangle(brushs.Value, rectdsts.Value) ' clear last sprite pos
drawerf.Refresh2(rectdsts.Value)
end sub
sub spmove(nsp) ' always move towards x + dx, y + dy
'erase original image on screen
sphide(nsp)
'move to new pos on bmpmap
spmap(nsp).x = min(bmpmap.Width - spmap(nsp).w, max(0, spmap(nsp).x + spmap(nsp).dx))
spmap(nsp).y = min(bmpmap.Height - spmap(nsp).h, max(0, spmap(nsp).y + spmap(nsp).dy))
' draw sp again
spshow(nsp)
spmap(nsp).moved = 0
spmap(nsp).dx = 0
spmap(nsp).dy = 0
if ptinrect(spmap(nsp).x, spmap(nsp).y, 10, 10, 60, 60) then
if spmap(nsp).acc = 0 then spslide(nsp)
end if
end sub