|
MX-Translator
6
24
920 bytes
1756 bytes
2003-09-29 00:00:00
2003-10-02 17:26:48
Oldes (oliva.david@seznam.cz)

special object for sprites movement
|
|
background 153.165.139
es: EmptySprite
shp_circle: Shape [
Bounds -15x-15 15x15
edge [width 3] fill color 255.200.100
circle 10
]
spr_circle: Sprite shp_circle
exportAssets [spr_circle "circle"]
translator: place es [
actions [
load [
objects: []
_global.maxSteps: 50
]
enterFrame [
for i 0 (objects.length) 1 [
obj: objects/:i
telltarget obj [
vx: vx + ((destx - _x) / ac)
vy: vy + ((desty - _y) / ac)
_x: _x + vx
_y: _y + vy
steps++
if ((math.abs((desty - _y)) < 1) and (math.abs((lvy - vy)) < 0.01))
or
(steps > maxSteps)
[
stops: true
]
lvx: vx lvy: vy
vx: vx * sl
vy: vy * sl
;_root.info: vx add "x" add vy add " " add _y
]
if obj.stops [
with obj [
vx: 20 - random 40
vy: 20 - random 40
destx: 40 + random 240
desty: 40 + random 240
ac: 30 + random 30
;sl: 0.85 ;math.abs((math.random() - 0.2))
stops: false
steps: 0
]
]
]
]
]
]
doAction [
i: 0
addCircle: func[][
i++
if i = 20 [
clearInterval(intID)
]
o: make object! [
_x: 0
_y: 0
destx: 40 + random 240
desty: 40 + random 240
vx: 0 vy: 0
ac: 10 + random 20 ;lower number means faster movement
sl: 0.75
steps: 0
]
attachMovie("circle" ("c" add i) (i + 10) o)
translator.objects.push((eval(eval("c" add i))))
]
intID: setInterval(addCircle 200)
stop
]
showFrame
end
|