Browse Search Popular Register Upload Rules User list Login:
Search:
Swatch

Image:
screenshot of the scene

Author: ElliottBelardo

Group: Default

Filesize: 4.27 kB

Date added: 2014-06-19

Rating: 5

Downloads: 177

Views: 133

Comments: 1

Ratings: 1

Times favored: 0

Made with: Algodoo v2.1.0

Tags:

Scene tag

I'm trying out scripting. The blue box, held by the blue platform, colors everything it touches the same color it is. How it works is an oncollide script that changes the color of the neighboring object (the object our swatch touches on collide) to 0,0,1,1, which is blue.
Please log in to rate this scene
edit
Similar scenes
Title: [Thyme] Paint
Rating: 5.25
Filesize: 17.88 kB
Downloads: 974
Comments: 2
Ratings: 2
Date added: 2009/05/16 05:53:15
Made with: Phun
Rating: rated 5.3
download
Here's a slightly more advanced (and more convenient) way of handling the colors:

1. Create the following local variables in the small box (type the following three lines into the text box in the upper left of the script menu):

_Red := [1,0,0,1]
_Green := [0,1,0,1]
_Blue := [0,0,1,1]

After entering those three lines, you should now see three new local variables in the script menu.

2. Now you can decide which color that you want other geometries to change to during collision with the following onCollide script. For example, if you want Red, just use the following script:

{e.other.color = _Red }

If you want Green or Blue, just use {e.other.color = _Green} or {e.other.color = _Blue}. Now you do not need to remember which arrays are used for which colors ([1,0,0,1] is an array). Just type the actual name of the color, starting with the underscore character!
Last edited at 2014/06/19 22:47:05 by Xray