501 === <tt>!GetGearPos(gearUid)</tt> === |
501 === <tt>!GetGearPos(gearUid)</tt> === |
502 Get pos of specified gear. |
502 Get pos of specified gear. |
503 |
503 |
504 === <tt>!GetVisualGearValues(vgUid)</tt> === |
504 === <tt>!GetVisualGearValues(vgUid)</tt> === |
505 This returns the typically set visual gear values, useful if manipulating things like smoke or bubbles or circles. It returns the following values: |
505 This returns the typically set visual gear values, useful if manipulating things like smoke or bubbles or circles. It returns the following values: |
506 X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint |
506 X, Y, dX, dY, Angle, Frame, !FrameTicks, State, Timer, Tint |
507 X, Y typically position, dX, dY typically speed, Angle is usually the rotation angle, Frame is typically the animation frame, FrameTicks is usually an animation counter. State can have a variety of values, but is typically bit packed, Timer is usually the gear lifetime and Tint is the colour. |
507 X, Y typically position, dX, dY typically speed, Angle is usually the rotation angle, Frame is typically the animation frame, !FrameTicks is usually an animation counter. State can have a variety of values, but is typically bit packed, Timer is usually the gear lifetime and Tint is the colour. |
508 Most visual gears require little to no modification of parameters. |
508 Most visual gears require little to no modification of parameters. |
509 |
509 |
510 Example: |
510 Example: |
511 |
511 |
512 <code language="lua"> GetVisualGearValues(vgUid) -- return visual gear values |
512 <code language="lua"> GetVisualGearValues(vgUid) -- return visual gear values |
553 Most visual gears require little to no modification of parameters. |
553 Most visual gears require little to no modification of parameters. |
554 |
554 |
555 Example: |
555 Example: |
556 |
556 |
557 <code language="lua"> -- set a circle to position 1000,1000 pulsing from opacity 20 to 200 (8%-78%), radius of 50, 3px thickness, bright red. |
557 <code language="lua"> -- set a circle to position 1000,1000 pulsing from opacity 20 to 200 (8%-78%), radius of 50, 3px thickness, bright red. |
558 SetVisualGearValues(circleUid, 1000,1000, 20, 200, 0, 0, 100, 50, 3, 0xff0000ff) |
558 SetVisualGearValues(circleUid, 1000,1000, 20, 200, 0, 0, 100, 50, 3, 0xff0000ff)</code> |
559 </code> |
559 |
|
560 Beginning from 0.9.21-dev, the 2nd to 11th arguments are optional. Any such argument which is declared as `nil` will not overwrite the corresponding value of the visual gear. With this change, it is not required anymore to call `GetVisualGearValues` beforehand. |
|
561 |
|
562 Examples: |
|
563 |
|
564 <code language="lua"> -- set a circle to position 1000,1000 |
|
565 SetVisualGearValues(circleUid, 1000, 1000)</code> |
|
566 <code language="lua"> -- set the color of a circle to bright red. |
|
567 SetVisualGearValues(circleUid, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xff0000ff)</code> |
|
568 |
560 |
569 |
561 === <tt>!FindPlace(gearUid, fall, left, right, tryHarder) (0.9.16)</tt> === |
570 === <tt>!FindPlace(gearUid, fall, left, right, tryHarder) (0.9.16)</tt> === |
562 Finds a place for the specified gear between x=`left` and x=`right` and places it there. 0.9.16 adds an optional fifth parameter, `tryHarder`. Setting to `true`/`false` will determine whether the engine attempts to make additional passes, even attempting to place gears on top of each other. |
571 Finds a place for the specified gear between x=`left` and x=`right` and places it there. 0.9.16 adds an optional fifth parameter, `tryHarder`. Setting to `true`/`false` will determine whether the engine attempts to make additional passes, even attempting to place gears on top of each other. |
563 |
572 |
564 Example: |
573 Example: |