If you want the gif image please let me know and I can e-mail it to you. Thanks.
Code: Select all
@DISPLAY 1, {Hidden=True}
@FILE 1, "walkr.gif"
@ANIM 1, "walkr.gif", {Transparency=0, Width=32, Height=32, Frames=8}
;some contants; they are set during compilation while GetAttribute happens at run-time
#FWIDTH=32 ;frame width
#FHEIGHT=32 ;frame height
#FRAMES=8
SWIDTH=GetAttribute(#DISPLAY, 1, #ATTRMAXWIDTH) ;screen width
SHEIGHT=GetAttribute(#DISPLAY, 1, #ATTRMAXHEIGHT) ;screen height
SFLOOR=SHEIGHT-#FHEIGHT ;screen floor
SPUBLIC=GetAttribute(#DISPLAY, 1, #ATTRPUBSCREEN) ;public screen
cnt=0 ;pixels moved
move=0 ;moves for current background grab
frame=1 ;current frame to display
blag=0 ;brush id with background lagging behind as display moves
blead=0 ;brush id with background leading as display moves
bback=0 ;background brush
Function p_Walk()
move=move+1
cnt=cnt+1
If cnt+#FWIDTH>SWIDTH Then End()
frame=frame+1
If frame>#FRAMES Then frame=1
;after we've moved a frame
If move=#FWIDTH
move=0
FreeBrush(blag)
blag=blead
blead=GrabDesktop(Nil, {X=cnt+#FWIDTH, Y=SFLOOR, Width=#FWIDTH, Height=#FHEIGHT, PubScreen=SPUBLIC})
SelectBrush(bback)
DisplayBrush(blag, #LEFT, #TOP)
DisplayBrush(blead, #FWIDTH, #TOP)
EndSelect()
EndIf
CloseDisplay(2)
DisplayBrushPart(bback, move, #TOP, #CENTER, #CENTER, #FWIDTH, #FHEIGHT)
DisplayAnimFrame(1, #CENTER, #CENTER, frame)
MoveDisplay(cnt, SFLOOR)
OpenDisplay(2, {Active=False})
EndFunction
CreateDisplay(2, {X=#LEFT, Y=#BOTTOM, Width=#FWIDTH, Height=#FHEIGHT, Borderless=True, Active=False, PubScreen=SPUBLIC})
;grab lagging and leading background frames
blag=GrabDesktop(Nil, {X=0, Y=SFLOOR, Width=#FWIDTH, Height=#FHEIGHT, PubScreen=SPUBLIC})
blead=GrabDesktop(Nil, {X=#FWIDTH, Y=SFLOOR, Width=#FWIDTH, Height=#FHEIGHT, PubScreen=SPUBLIC})
SelectDisplay(2)
;create background brush
bback=CreateBrush(Nil, #FWIDTH*2, #FHEIGHT)
SelectBrush(bback)
DisplayBrush(blag, #LEFT, #TOP)
DisplayBrush(blead, #FWIDTH, #TOP)
EndSelect()
;initial display includes only the lagging background frame
ChangeDisplaySize(32, 32)
MoveDisplay(#LEFT, SFLOOR)
DisplayBrushPart(bback, #LEFT, #TOP, #CENTER, #CENTER, #FWIDTH, #FHEIGHT)
DisplayAnimFrame(1, #CENTER, #CENTER, frame)
OpenDisplay(2, {Active=False})
Repeat
Wait(5, #TICKS)
p_Walk()
Forever