Difference between revisions of "SLetanque"

From Second Life Wiki
Jump to navigation Jump to search
(New page: <pre> // SLetanque Jack Launcher by Babbage Linden // // Part of SLetanque // // Available under the Creative Commons Attribution-ShareAlike 2.5 license // http://creativecommons.org/licen...)
 
m (<lsl> tag to <source>)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<pre>
{{LSL Header}}
==Jack Launcher==
<source lang="lsl2">
// SLetanque Jack Launcher by Babbage Linden
// SLetanque Jack Launcher by Babbage Linden
//
//
Line 18: Line 20:
     }
     }
}
}
</pre>
</source>
<pre>
==Boule Launcher==
<source lang="lsl2">
// SLetanque Boule Launcher by Babbage Linden
// SLetanque Boule Launcher by Babbage Linden
//
//
Line 64: Line 67:
     }
     }
}
}
</pre>
</source>
 
{{LSLC|Library}}

Latest revision as of 09:10, 25 January 2015

Jack Launcher

// SLetanque Jack Launcher by Babbage Linden
//
// Part of SLetanque
//
// Available under the Creative Commons Attribution-ShareAlike 2.5 license
// http://creativecommons.org/licenses/by-sa/2.5/

default
{            
    touch_start(integer total_number)
    {
        rotation avatar_rotation = llGetRot();
        vector direction = llRot2Fwd(avatar_rotation);
        direction += <0,0,1>;
        float power = 2 + llFrand(8.0);
        llRezObject("SLetanque Jack", llGetPos() + direction, direction * power, <0,0,0,1>, 0);
    }
}

Boule Launcher

// SLetanque Boule Launcher by Babbage Linden
//
// Part of SLetanque
//
// Available under the Creative Commons Attribution-ShareAlike 2.5 license
// http://creativecommons.org/licenses/by-sa/2.5/

integer gPower = 0;
integer gMaxPower = 5;
float gPowerFactor = 3.0;

reset()
{
    llSetTimerEvent(1.0);
}

default
{
    state_entry()
    {
        reset();        
    }

    on_rez(integer param)
    {
        reset();
    }
            
    touch_start(integer total_number)
    {
        rotation avatar_rotation = llGetRot();
        vector direction = llRot2Fwd(avatar_rotation);
        direction += <0,0,0.95 + llFrand(0.1)>;
        float power = 2 + llFrand(0.2) + gPower * (gPowerFactor + llFrand(0.1));
        llRezObject("SLetanque", llGetPos() + direction, direction * power, <0,0,0,1>, 0);
    }
    
    timer()
    {
        ++gPower;
        gPower %= gMaxPower;
        llSetTexture("Power" + (string)gPower, 4);
    }
}