SLetanque

From Second Life Wiki
Revision as of 05:24, 8 December 2007 by Babbage Linden (talk | contribs) (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...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
// 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);
    }
}
// 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);
    }
}