
Lingo Dictionary
143
Example
This example has two parts. The first part is the first line of code, which registers the
#explode
handler for the
#collideAny
event. The second part is the
#explode
handler. When two models
in the cast member named MyScene collide, the
#explode
handler is called and the
collisionData
argument is sent to it. The first ten lines of the
#explode
handler create the
model resource SparkSource and set its properties. This model resource is a single burst of
particles. The tenth line sets the direction of the burst to
collisionNormal
, which is the
direction of the collision. The eleventh line of the handler creates a model called SparksModel
using the model resource SparkSource. The last line of the handler sets the position of
SparksModel to the position where the collision occurred. The overall effect is a collision that
causes a burst of sparks to fly in the direction of the collision from the point of contact.
member("MyScene").registerForEvent(#collideAny, #explode, 0)
on explode me, collisionData
nmr = member("MyScene").newModelResource("SparkSource", #particle)
nmr.emitter.mode = #burst
nmr.emitter.loop = 0
nmr.emitter.minSpeed = 30
nmr.emitter.maxSpeed = 50
nmr.emitter.angle = 45
nmr.colorRange.start = rgb(0, 0, 255)
nmr.colorRange.end = rgb(255, 0, 0)
nmr.lifetime = 5000
nmr.emitter.direction = collisionData.collisionNormal
nm = member("MyScene").newModel("SparksModel", nmr)
nm.transform.position = collisionData.pointOfContact
end
See also
pointOfContact
,
modelA
,
modelB
,
resolveA
,
resolveB
,
collision (modifier)
color()
Syntax
color(
#rgb, redValue, greenValue, blueValue
)
color(
#paletteIndex, paletteIndexNumber
)
rgb(
rgbHexString
)
rgb(
redValue, greenValue, blueValue
)
paletteIndex(
paletteIndexNumber
)
Description
Function and data type; determines an object’s color as either RGB or 8-bit palette index values.
These are the same values as those used in the
color
member and
color
sprite properties, the
bgColor
member and
bgColor
sprite properties, and the
bgColor
Stage property.
The
color
function allows for either 24-bit or 8-bit color values to be manipulated as well as
applied to cast members, sprites, and the Stage.
For RGB values, each color component has a range from 0 to 255, and all other values are
truncated. For
paletteIndex
types, an integer from 0 to 255 is used to indicate the index
number in the current palette, and all other values are truncated.
Содержание DIRECTOR MX-LINGO DICTIONARY
Страница 1: ...Lingo Dictionary Macromedia Director MX...
Страница 756: ...Index 756...