|
SWF5-Screen Scroller
5
30
739 bytes
1436 bytes
2003-07-29 00:00:00
2003-07-29 12:14:06
oldes (oliva.david@seznam.cz)

How to smoothly scroll sprites to given position.
|
|
background 152.174.149
shp_circle: Shape [
Bounds -15x-15 15x15
edge [width 3] fill color 255.200.100
circle 10
]
spr_circle: Sprite shp_circle
circle: place spr_circle [
at 0x0
actions [
load [
destx: desty: 160
vx: vy: 0
ac: 50 ;lower number means faster movement
sl: 0.8 ;lower number means bigger slowdown
]
enterFrame [
constantPool [vx vy destx desty _x _y ac]
vx: vx + ((destx - _x) / ac)
vy: vy + ((desty - _y) / ac)
_x: _x + vx
_y: _y + vy
vx: vx * sl
vy: vy * sl
]
mouseMove [
destx: _root._xmouse
desty: _root._ymouse
]
]
]
showFrame
ImportAssets [obj_slider "slider"] from %slider.swf
sl_sl: place obj_slider [at 160x0 scale [0.6 .8]]
sl_ac: place obj_slider [at 20x0 scale [0.6 .8]]
DoAction [
tellTarget sl_ac [
onChange: func[][
_parent.circle.ac: to-integer (100 * value)
_parent.transform()
]
init(.5 "AC:")
]
tellTarget sl_sl [
onChange: func[][
_parent.circle.sl: value
_parent.transform()
]
init(.8 "SL:")
]
stop
]
showFrame
end
|