property pOrigLocV1, pOrigLocV2, pMax, pLocV
global g_speed, g_direction
on getPropertyDescriptionList me
list = [:]
addProp list, #pMax, [#comment:"Maximum pixels to be moved",#format:#integer,#default:0]
return list
end
on beginSprite me
pOrigLocV1 = sprite(me.spriteNum).locV
pOrigLocV2 = sprite(me.spriteNum).locV + pMax
reset(me)
end
on reset me
pLocV = 0
if g_direction = "Forward" then
sprite(me.spriteNum).locV = pOrigLocV1
else
if g_direction = "Backward" then
sprite(me.spriteNum).locV = pOrigLocV2
end if
end if
end
on exitFrame me
pLocV = pLocV + pMax / g_speed
if g_direction = "Forward" then
sprite(me.spriteNum).locV = pOrigLocV1 + pLocV
else
if g_direction = "Backward" then
sprite(me.spriteNum).locV = pOrigLocV2 - pLocV
end if
end if
if g_direction = "Forward" then
if sprite(me.spriteNum).locV >= pOrigLocV1 + pMax then
reset(me)
end if
else
if g_direction = "Backward" then
if sprite(me.spriteNum).locV <= pOrigLocV1 then
reset(me)
end if
end if
end if
end
-------------------------------------------------------------------
-- Move left or right
on getPropertyDescriptionList me
list = [:]
addProp list, #pMaxL, [#comment:"Maximum pixels moved to the left",#format:#integer,#default:0]
addProp list, #pMaxR, [#comment:"Maximum pixels moved to the right",#format:#integer,#default:0]
addProp list, #pMaxAR, [#comment:"Maximum angle rotated to the right",#format:#integer,#default:0]
addProp list, #pMaxAL, [#comment:"Maximum angle rotated to the left",#format:#integer,#default:0]
return list
end
on beginSprite me
pOrigLocH1 = sprite(me.spriteNum).locH
pOrigLocH2 = sprite(me.spriteNum).locH - pMaxL
pOrigAngle = sprite(me.spriteNum).rotation
reset(me)
end
on reset me
pLocH = 0
sprite(me.spriteNum).locH = pOrigLocH1
sprite(me.spriteNum).rotation = pOrigAngle
end
on exitFrame me
if g_direction = "Left" then
pLocH = pLocH + pMaxR / g_speed
pAngle = (pMaxAL - pOrigAngle) / g_speed
sprite(me.spriteNum).locH = pOrigLocH1 + pLocH
sprite(me.spriteNum).rotation = sprite(me.spriteNum).rotation + pAngle
else
if g_direction = "Right" then
pLocH = pLocH + pMaxL / g_speed
pAngle = (pMaxAR - pOrigAngle) / g_speed
sprite(me.spriteNum).locH = pOrigLocH1 - pLocH
sprite(me.spriteNum).rotation = sprite(me.spriteNum).rotation + pAngle
end if
end if
if g_direction = "Left" then
if sprite(me.spriteNum).locH >= pOrigLocH1 + pMaxR then
reset(me)
end if
else
if g_direction = "Right" then
if sprite(me.spriteNum).locH <= pOrigLocH2 then
reset(me)
end if
end if
end if
end
-------------------------- end ---------------------------------
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA