以上图为例,现在显示了5张图片,但一按滚动键,有时就要显示6张,因此score上需要6个或7个通道放图片。
给你一段程序,基本思路是滚动它们的locV,如果有图片滚到边界就把它替换为其它图片,同时调整它的locH。如果已经替换到了最后一张图片,就替换为一张,反之替换为最后一张。
程序中我自定义了许多以p开头的属性,从名字上你应该看得出它的作用:
on circlePic direct
case direct of
1:
repeat with i=pFSprite to pLSprite
sprite(i).locH=sprite(i).locH-pPicStep
end repeat
if (sprite(pPicAtLeft).right
if (sprite(pPicAtRight).member.name<>pLMember) then
sprite(pPicAtLeft).member=member(sprite(pPicAtRight).member.memberNum+1,pPicOwnerCast)
else
sprite(pPicAtLeft).member=member(sprite(pFMember),pPicOwnerCast)
end if
updateStage---注意!!!!!!!!!没有这一句,member替换语句的作用就不会被应用
sprite(pPicAtLeft).loch=sprite(pPicAtRight).right+15+sprite(pPicAtLeft).member.width/2
updateStage
pPicAtRight=pPicAtLeft
if (pPicAtLeft pPicAtLeft=pPicAtLeft+1
else
pPicAtLeft=pFSprite
end if
end if
-1:
repeat with i=pFSprite to pLSprite
sprite(i).locH=sprite(i).locH+pPicStep
end repeat
if (sprite(pPicAtLeft).Left-15>pLeftBorder) then
if (sprite(pPicAtLeft).member.name<>pFMember) then
sprite(pPicAtRight).member=member(sprite(pPicAtLeft).member.memberNum-1,pPicOwnerCast)
else
sprite(pPicAtRight).member=member(pLMember,pPicOwnerCast)
end if
updateStage---注意!!!!!!!!!没有这一句,member替换语句的作用就不会被应用
sprite(pPicAtRight).loch=sprite(pPicAtLeft).left-15-sprite(pPicAtRight).member.width/2
pPicAtLeft=pPicAtRight
if (pPicAtRight>pFSprite) then
pPicAtRight=pPicAtLeft-1
else
pPicAtRight=pLSprite
end if
end if
end case
end