Moving Platforms & patrol

I did this script for moving platforms to move along a path, but it can be used also for patrol behaviors.

screenPatrol

What this is script is doing is basically move the object this script is attached along a path of nodes, and waits in each node during the specified Waiting Time.

Moving Time is the time to go from a node to the next one.

There is 3 modes for patrol:

  • None: the object stops when reaching the target position
  • Loop: the object goes through all the nodes in a loop
  • Ping-Pong: the object is going forward through the path, then in reverse, once it reach the last node
patrolLoop

Loop

patrolPingPong

Ping-Pong

Editing the path is simple. The first node will be always at object position, and there will be a minimum of 2 nodes.

You can add a node by selecting one of them and Shift + Dragging the node.

patrol0

Shift + Click + Dragging

You can remove the nodes by Ctrl + Clicking on any of them

patrol1

Control + Click

And finally, you can drag any of the nodes by dragging any node or move all of them in block by moving the parent object

patrol2

Dragging nodes

Holding Ctrl while dragging a node will snap its position

patrol4

Dragging nodes + holding Control

Download the scripts for this behavior here

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s