Nuke (Mushroom Cloud Generator)

Discuss scenes and videos made with Algodoo.

Nuke (Mushroom Cloud Generator)

Postby Rideg » Sun Dec 19, 2010 4:14 pm

Rating: rated 9.1
Filesize: 306.06 kB
Comments: 115
Ratings: 37
download


I'm done with my biggest script project. It spawns circles with different properties in different orders so a mushroom cloud can be made. I spent alot of time fixing issues with the script when it didn't work and sometimes I was close to abandon this project but I'm glad I completed it.

The scene in general is a missile falling down to the ground and when it hits, it will automaticly zoom out so you can get a good look on the mushroom cloud.

I've never put as much work and thoughts into any of my other scenes than I did with this one. I started in the spring and now it's mid-winter.

How big is the script? Well I pasted it in Microsoft Word Document and got a number of 351 lines of thyme. In the Algodoo version I used when I started on this, the program lagged when you opened the script menu so I had to split the script into several objects. Thanks to The Algodoo developers I could put everything in one laser and one circle without any issues.

Here's the script:

OnCollide Script:
I call this the "initiator" it starts the script and work together with the onHitByLaser
Code: Select all
(e)=>{
    {e.this.drawCake} ? {
        scene.camera.pan = scene.camera.pan + [0.0, 100.0];
        e.this.restitution = 0.1;
        e.this.textureMatrix = [1.0, 0.0, 0.0, 0.0, e.pos(0), e.pos(1), 0.0, 100.0, 1.0];
        e.this.color = [e.pos(0), e.pos(1), e.pos(0), 1.0];
        scene.addCircle({
            density := +inf;
            color := [0.0, 0.0, 0.0, 0.0];
            drawBorder := false;
            drawCake := false;
            radius := 0.1;
            geomID := 2133;
            collideSet := 0;
            pos := e.pos
        });
        scene.addPen({
            size := 120.0;
            zDepth := 1000;
            geom := 2133;
            relPoint := [0.0, 0.0];
            color := [0.2, 0.2, 0.2, 1.0]
        });
        Scene.addCircle({
            color := [1.0, 1.0, 0.1, 1.0];
            onHitByLaser := (e)=>{e.geom.color = e.geom.color - [0.0, 0.0, 0.0, 0.001]};
            refractiveIndex := 0.01;
            drawBorder := false;
            drawCake := false;
            density := +inf;
            textureMatrix := [0.00077190273, 0.0, 0.5, 0.0, 0.00077190273, 0.5, 0.0, 0.0, 1.0];
            controllerAcc = 0;
            texture := "AtombombFlash.png";
            collideSet := 32;
            zDepth := +inf;
            pos := e.pos;
            radius := 647.75;
            onHitByLaser := (e)=>{
                e.geom.controllerAcc = e.geom.controllerAcc + 1;
                e.geom.controllerAcc >= 50 ? {e.geom.color = e.geom.color - [0.0, 0.0, 0.0, 0.01]} : {};
                {e.geom.color(3) <= 0} ? {e.geom.density = 0} : {}
            }
        });
        scene.addLaserPen({
            size := 0.01;
            maxrays := 1;
            rotation := -1.5707965;
            pos := e.pos + [0.0, 648.0]
        });
        Scene.addCircle({
            color := [1.0, 1.0, 1.0, 1.0];
            onHitByLaser := (e)=>{e.geom.color = e.geom.color - [0.0, 0.0, 0.0, 0.001]};
            refractiveIndex := 0.01;
            drawBorder := false;
            drawCake := false;
            density := +inf;
            textureMatrix := [0.0011258518, 0.0, 0.49999997, 0.0, 0.0011258518, 0.49999994, 0.0, 0.0, 0.9999998];
            controllerAcc = 0;
            texture := "AtombombFlash.png";
            collideSet := 32;
            zDepth := +inf;
            pos := e.pos;
            radius := 647.75;
            onHitByLaser := (e)=>{
                e.geom.controllerAcc = e.geom.controllerAcc + 1;
                e.geom.controllerAcc >= 50 ? {e.geom.color = e.geom.color - [0.0, 0.0, 0.0, 0.01]} : {};
                {e.geom.color(3) <= 0} ? {e.geom.density = 0} : {}
            }
        });
        scene.addLaserPen({
            size := 0.01;
            maxrays := 1;
            rotation := -1.5707965;
            pos := e.pos + [0.0, 648.0]
        });
        for(3, (i)=>{
            Scene.addCircle({
                color := [0.0, 0.0, 0.0, 0.0];
                drawBorder := false;
                drawCake := false;
                airFrictionMult := 1000000;
                density := 1000.0;
                collideSet := 31;
                heteroCollide = true;
                geomID := 3;
                vel := [0.0, -20.0];
                pos := e.pos + [0.0, 10.0];
                radius := 1.5
            });
            Scene.addPen({
                geom := 3;
                relPoint := [0.0, 0.0];
                color := [e.this.textureMatrix(0), e.this.textureMatrix(1), e.this.textureMatrix(2), e.this.textureMatrix(3)];
                fadeTime := 15.0;
                size := 7;
                zDepth := +inf
            })
        });
        e.this.refractiveIndex = 1;
        e.this.onCollide = (e)=>{}
    } : {}
}
onCollide: 106 lines of thyme.

OnHitByLaser: This "produces" the mushroom cloud
Code: Select all
(e)=>{
    {e.laser.color(0) == 1.0 && e.geom.refractiveIndex == 1} ? {
        scene.camera.zoom = 1.5;
        e.geom.friction >= 40 ? {
            Scene.addCircle({
                color := [0.0, 0.0, 0.0, 0.0];
                drawBorder := false;
                drawCake := false;
                airFrictionMult := 1600000;
                density := 5000.0;
                collideSet := 31;
                geomID := 3;
                controllerAcc := sim.time;
                onCollide := (e)=>{
                    sim.time - e.this.controllerAcc >= 2 ? {
                        e.this.refractiveIndex = {sim.time};
                        e.this.density = {refractiveIndex - controllerAcc >= 5 ? 1000 : 10000}
                    } : {}
                };
                vel := [0.0, 400.0];
                pos := [e.geom.textureMatrix(4), e.geom.textureMatrix(5)] + [5.0, 0.0];
                radius := 1.5
            });
            smoke1 = Scene.addPen({
                geom := 3;
                relPoint := [0.0, 0.0];
                fadeTime := e.geom.density - 2;
                size := 15;
                zDepth := 1
            });
            randomGrey1 = (smoke1.color(0) * (0.2 - 0.15) + 0.15);
            smoke1.color = [randomGrey1, randomGrey1, randomGrey1, 1.0];
            Scene.addCircle({
                color := [0.0, 0.0, 0.0, 0.0];
                drawBorder := false;
                drawCake := false;
                airFrictionMult := 1600000;
                density := 5000.0;
                collideSet := 31;
                geomID := 3;
                controllerAcc := sim.time;
                onCollide := (e)=>{
                    sim.time - e.this.controllerAcc >= 2 ? {
                        e.this.refractiveIndex = {sim.time};
                        e.this.density = {refractiveIndex - controllerAcc >= 5 ? 1000 : 10000}
                    } : {}
                };
                vel := [0.0, 400.0];
                pos := [e.geom.textureMatrix(4), e.geom.textureMatrix(5)];
                radius := 1.5
            });
            smoke2 = Scene.addPen({
                geom := 3;
                relPoint := [0.0, 0.0];
                fadeTime := e.geom.density - 2;
                size := 30;
                zDepth := 1
            });
            randomGrey2 = (smoke2.color(0) * (0.2 - 0.15) + 0.15);
            smoke2.color = [randomGrey2, randomGrey2, randomGrey2, 1.0];
            Scene.addCircle({
                color := [0.0, 0.0, 0.0, 0.0];
                drawBorder := false;
                drawCake := false;
                airFrictionMult := 1600000;
                density := 5000.0;
                collideSet := 31;
                geomID := 3;
                controllerAcc := sim.time;
                onCollide := (e)=>{
                    sim.time - e.this.controllerAcc >= 2 ? {
                        e.this.refractiveIndex = {sim.time};
                        e.this.density = {refractiveIndex - controllerAcc >= 5 ? 1000 : 10000}
                    } : {}
                };
                vel := [0.0, 400.0];
                pos := [e.geom.textureMatrix(4), e.geom.textureMatrix(5)] - [5.0, 0.0];
                radius := 1.5
            });
            smoke3 = Scene.addPen({
                geom := 3;
                relPoint := [0.0, 0.0];
                fadeTime := e.geom.density - 2;
                size := 30;
                zDepth := 1
            });
            randomGrey3 = (smoke3.color(0) * (0.2 - 0.15) + 0.15);
            smoke3.color = [randomGrey3, randomGrey3, randomGrey3, 1.0]
        } : {};
        e.geom.friction < 40 ? {
            Scene.addCircle({
                color := [0.0, 0.0, 0.0, 0.0];
                drawBorder := false;
                drawCake := false;
                airFrictionMult := 1600000;
                density := 3300.0;
                collideSet := 31;
                heteroCollide := heteroCollide;
                geomID := 3;
                controllerAcc := sim.time;
                onCollide := (e)=>{
                    sim.time - e.this.controllerAcc >= 2 ? {
                        e.this.refractiveIndex = {sim.time};
                        e.this.density = {refractiveIndex - controllerAcc >= 5 ? 1000 : 10000}
                    } : {}
                };
                vel := [0.0, 400.0];
                pos := [e.geom.textureMatrix(4), e.geom.textureMatrix(5)] + [10.25, 0.0];
                radius := 3
            });
            smoke10 = Scene.addPen({
                geom := 3;
                relPoint := [0.0, 0.0];
                color = [0.3, 0.3, 0.3, 1.0];
                fadeTime := e.geom.density - 2;
                size := 30;
                zDepth := -1
            });
            randomGrey10 = (smoke10.color(0) * (0.2 - 0.15) + 0.15);
            smoke10.color = [randomGrey10, randomGrey10, randomGrey10, 1.0];
            Scene.addCircle({
                color := [0.0, 0.0, 0.0, 0.0];
                drawBorder := false;
                drawCake := false;
                airFrictionMult := 1600000;
                density := 3300.0;
                collideSet := 31;
                heteroCollide := heteroCollide;
                geomID := 3;
                controllerAcc := sim.time;
                onCollide := (e)=>{
                    sim.time - e.this.controllerAcc >= 2 ? {
                        e.this.refractiveIndex = {sim.time};
                        e.this.density = {refractiveIndex - controllerAcc >= 5 ? 1000 : 10000}
                    } : {}
                };
                vel := [0.0, 400.0];
                pos := [e.geom.textureMatrix(4), e.geom.textureMatrix(5)];
                radius := 3
            });
            smoke20 = Scene.addPen({
                geom := 3;
                relPoint := [0.0, 0.0];
                fadeTime := e.geom.density - 2;
                size := 30;
                zDepth := -1
            });
            randomGrey20 = (smoke20.color(0) * (0.2 - 0.15) + 0.15);
            smoke20.color = [randomGrey20, randomGrey20, randomGrey20, 1.0];
            Scene.addCircle({
                color := [0.0, 0.0, 0.0, 0.0];
                drawBorder := false;
                drawCake := false;
                airFrictionMult := 1600000;
                density := 3300.0;
                collideSet := 31;
                heteroCollide := heteroCollide;
                geomID := 3;
                controllerAcc := sim.time;
                onCollide := (e)=>{
                    sim.time - e.this.controllerAcc >= 2 ? {
                        e.this.refractiveIndex = {sim.time};
                        e.this.density = {refractiveIndex - controllerAcc >= 5 ? 1000 : 10000}
                    } : {}
                };
                vel := [0.0, 400.0];
                pos := [e.geom.textureMatrix(4), e.geom.textureMatrix(5)] - [10.25, 0.0];
                radius := 3
            });
            smoke30 = Scene.addPen({
                geom := 3;
                relPoint := [0.0, 0.0];
                color := [0.3, 0.3, 0.3, 1.0];
                fadeTime := e.geom.density - 2;
                size := 30;
                zDepth := -1
            });
            randomGrey30 = (smoke30.color(0) * (0.2 - 0.15) + 0.15);
            smoke30.color = [randomGrey30, randomGrey30, randomGrey30, 1.0]
        } : {};
        {e.geom.friction >= 125} ? {
            Scene.addCircle({
                color := [0.0, 0.0, 0.0, 0.0];
                drawBorder := false;
                drawCake := false;
                onCollide := (e)=>{
                    controllerAcc = sim.time;
                    onCollide = (e)=>{{sim.time - controllerAcc >= 3} ? {} : {}}
                };
                airFrictionMult := 5000000;
                density := 1000.0;
                collideSet := 31;
                geomID := 1;
                pos := [e.geom.color(0), e.geom.color(1)] + [35, 0];
                vel := [0.0, e.geom.friction];
                radius := 1.5
            });
            smoke4 = Scene.addPen({
                geom := 1;
                relPoint := [0.0, 0.0];
                fadeTime := 0.0;
                size := textureMatrix(7);
                zDepth := friction;
                rotation := 0.0
            });
            randomGrey4 = (smoke4.color(0) * (0.2 - 0.15) + 0.15);
            smoke4.color = [randomGrey4, randomGrey4, randomGrey4, 1.0];
            Scene.addCircle({
                color := [0.0, 0.0, 0.0, 0.0];
                drawBorder := false;
                drawCake := false;
                onCollide := (e)=>{
                    controllerAcc = sim.time;
                    onCollide = (e)=>{{sim.time - controllerAcc >= 3} ? {} : {}}
                };
                airFrictionMult := 5000000;
                density := 1000.0;
                collideSet := 31;
                geomID := 2;
                pos := [e.geom.color(2), e.geom.color(1)] - [35, 0];
                vel := [0.0, e.geom.friction];
                radius := 1.5
            });
            smoke5 = Scene.addPen({
                geom := 2;
                relPoint := [0.0, 0.0];
                fadeTime := 0.0;
                size := textureMatrix(7);
                zDepth := friction;
                rotation := 0.0
            });
            randomGrey5 = (smoke5.color(0) * (0.2 - 0.15) + 0.15);
            smoke5.color = [randomGrey5, randomGrey5, randomGrey5, 1.0];
            e.geom.textureMatrix = e.geom.textureMatrix - [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0]
        } : {};
        e.geom.color = e.geom.color + [3.0, 0.0, 0.0, 0.0];
        e.geom.color = e.geom.color - [0.0, 0.0, 3.0, 0.0];
        e.geom.friction = e.geom.friction - 1;
        {e.geom.friction <= 20} ? {e.geom.density = 0} : {}
    } : {};
    e.geom.color = e.geom.color + [0.0, 0.0, 0.0, 1.0];
    {e.geom.color(3) % 3 == 0} ? {e.geom.heteroCollide = false} : {e.geom.heteroCollide = true};
    e.geom.textureMatrix = e.geom.textureMatrix + [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0];
    {e.geom.textureMatrix(8) >= 10} ? {e.geom.density = 27.0} : {e.geom.density = 2.0}
}
onHitByLaser: 245 lines of thyme
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden

Re: Nuke (Mushroom Cloud Generator)

Postby kilebantick » Thu Dec 23, 2010 12:39 pm

Looked epic! Well worth all the effort you put into it for sure!
Image
User avatar
kilebantick
 
Posts: 1267
Joined: Tue Sep 01, 2009 9:50 am

Re: Nuke (Mushroom Cloud Generator)

Postby jakedmoon » Thu Jan 06, 2011 8:34 pm

these are the kind of scenes that make me want algodoo
Ουλές αποτελούν απόδειξη ότι το παρελθόν υπήρχε.
User avatar
jakedmoon
 
Posts: 300
Joined: Sat Jul 03, 2010 11:41 pm
Location: earth

Re: Nuke (Mushroom Cloud Generator)

Postby Rideg » Thu Jan 06, 2011 9:19 pm

Get it :thumbup:
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden

Re: Nuke (Mushroom Cloud Generator)

Postby jakedmoon » Fri Jan 07, 2011 12:38 am

i am seriously considering it
but i dont want to leave me fellow phunners out in the cold if i was to get algodoo than i would have to make doubles of every scene i madewhich would anger many algodooers
Ουλές αποτελούν απόδειξη ότι το παρελθόν υπήρχε.
User avatar
jakedmoon
 
Posts: 300
Joined: Sat Jul 03, 2010 11:41 pm
Location: earth

Re: Nuke (Mushroom Cloud Generator)

Postby Rrobba » Fri Jan 07, 2011 11:47 am

Great scene, Rideg. I love it! :clap: :D
Image
I don't suffer from insanity. I enjoy every minute of it.
User avatar
Rrobba
[Best Sig 2010]
 
Posts: 1480
Joined: Mon Aug 31, 2009 6:01 pm
Location: Gibraltar

Re: Nuke (Mushroom Cloud Generator)

Postby Rideg » Fri Jan 07, 2011 5:55 pm

jakedmoon wrote:i am seriously considering it
but i dont want to leave me fellow phunners out in the cold if i was to get algodoo than i would have to make doubles of every scene i madewhich would anger many algodooers

You can still make phun-safe scenes :P
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden

Re: Nuke (Mushroom Cloud Generator)

Postby jakedmoon » Fri Jan 07, 2011 8:25 pm

i can make phun safe scenes but on my basic suspensions and such the springs would need strengthened to work properly
Ουλές αποτελούν απόδειξη ότι το παρελθόν υπήρχε.
User avatar
jakedmoon
 
Posts: 300
Joined: Sat Jul 03, 2010 11:41 pm
Location: earth


Return to Scenes

Who is online

Users browsing this forum: No registered users and 3 guests