Page 1 of 1

[Help] Object Sliding

Posted: Sun Mar 09, 2014 7:40 am
by Piconoe
How do you make individual objects slowly slide independent of others. Need it to make the port for the final laser in my N.E.X.U.S. level open up properly so it can remain open in a cool fashion instead of just rotating and blowing up like it does now. That's the only disappointment I have with the stage so far.

Re: [Help] Object Sliding

Posted: Mon May 12, 2014 11:29 am
by MD
There are a few ways.

1. Use rotations.

See thread Pushing the Limits :: Scripting Straight Line Movement

2. Use many setDistance calls (this moves part #1):

Code: Select all

makeTrigger, timeRepeat, 30, 45, setDistance, 50, 1
makeTrigger, timeRepeat, 31, 45, setDistance, 53, 1
makeTrigger, timeRepeat, 32, 45, setDistance, 56, 1
makeTrigger, timeRepeat, 33, 45, setDistance, 59, 1
makeTrigger, timeRepeat, 34, 45, setDistance, 62, 1
makeTrigger, timeRepeat, 35, 45, setDistance, 65, 1
makeTrigger, timeRepeat, 36, 45, setDistance, 68, 1
makeTrigger, timeRepeat, 37, 45, setDistance, 71, 1
makeTrigger, timeRepeat, 38, 45, setDistance, 74, 1
makeTrigger, timeRepeat, 39, 45, setDistance, 77, 1
makeTrigger, timeRepeat, 40, 45, setDistance, 80, 1
makeTrigger, timeRepeat, 41, 45, setDistance, 83, 1
makeTrigger, timeRepeat, 42, 45, setDistance, 86, 1
makeTrigger, timeRepeat, 43, 45, setDistance, 89, 1
makeTrigger, timeRepeat, 44, 45, setDistance, 92, 1
3. Use the Python library I just posted.

Examples below can be seen in this level.

Example 1: On part #1 (green): For 2 seconds, wait at position 200, then move for 1 second from position 50 to 200, and repeat. By "position" I actually mean the distance from the part to its parent.

Code: Select all

from zfai import *

waitTime = secToFrames(2)
waitAt = 200
moveTime = secToFrames(1)
printAll(macro_linearMove("1", waitTime, moveTime, 50, 200, waitAt))
Example 2: On part #3 (red): For 2 seconds move from position 100 to 200, then for another 2 seconds move back from position 200 to 100, and repeat.

Code: Select all

from zfai import *

moveOneWayDuration = secToFrames(2)
printAll(macro_linearMove("3", moveOneWayDuration, moveOneWayDuration, 100, 200, None, -moveOneWayDuration))
printAll(macro_linearMove("3", moveOneWayDuration, moveOneWayDuration, 200, 100, None, 0))
~MD