I think the thing to do would be to sort of follow Paradigm's lead. To an extent.
Rating: ![8 rated 8](http://www.algodoo.com/algobox/theme/1/img/small_rating_8.png)
Filesize: 16.9 kB
Comments: 9
Ratings: 12
You'll want to place each frame, once it's completed, into an array. You'll probably want a big array, containing the entirety of each frame, containing each row in that frame, containing each pixel in that row, containing the color of that pixel.
So, the opacity of pixel 5, row 4, frame 2 would be scene.my.video(2)(4)(5)(3) = 1.
Note that the earliest frame, the top row, and the leftest pixel are all labeled 0.
onCollide, can easily be changed to onHitByLaser, each pixel will need this code:
- Code: Select all
e.this.row = 0;
e.this.column = 0;
(e.this) -> {color = {scene.my.videoFrameCurrent(row)(column)}}
Upon running the video, you'll want this:
- Code: Select all
{scene.my.playVideo} ? {
scene.my.currentFrame = scene.my.currentFrame + 1;
scene.my.videoFrameCurrent = scene.my.video(scene.my.currentFrame)
} : {}
onCollide, each very light circle on the coloring pad receives this code:
- Code: Select all
e.this.row = 0;
e.this.column = 0;
scene.my.frameCurrent = scene.my.arrayChange(
scene.my.frameCurrent, row, scene.my.arrayChange(
scene.my.frameCurrent(row), column, e.other.color
)
);
{! scene.my.playVideo} ? {scene.my.videoFrameCurrent = scene.my.frameCurrent} : {}
The "Save Display As Next Frame" button gets this code:
- Code: Select all
scene.my.video = scene.my.arrayChange(scene.my.video, scene.my.currentFrame)
There would have to be Play, Pause, and Stop buttons, I'll let you code these yourself.
And finally:
Credit to Gradyfitz and Karatebrot on these. I edited and straightened them up a bit.
- Code: Select all
Scene.my.arraySize = (array) => {
a := array ++ ["enD"];
n := 0;
SizeUnknown := true;
for(65, (i)=>{{SizeUnknown && ("" + a(i) == "enD")} ? {
n = i;
SizeUnknown = false } : { }
});
n
};
scene.my.ArrayChange = (array, pos, value) => {
result := [];
for(scene.my.arraySize(array), (i)=>{
{i == n} ? {
result = result ++ [value]
} : {
result = result ++ [array(i)]
}
});
result
}