Difference between revisions of "SLetanque"

From Second Life Wiki
Jump to navigation Jump to search
(Brushed up and added to category)
m (<lsl> tag to <source>)
 
Line 1: Line 1:
{{LSL Header}}
{{LSL Header}}
==Jack Launcher==
==Jack Launcher==
<lsl>
<source lang="lsl2">
// SLetanque Jack Launcher by Babbage Linden
// SLetanque Jack Launcher by Babbage Linden
//
//
Line 20: Line 20:
     }
     }
}
}
</lsl>
</source>
==Boule Launcher==
==Boule Launcher==
<lsl>
<source lang="lsl2">
// SLetanque Boule Launcher by Babbage Linden
// SLetanque Boule Launcher by Babbage Linden
//
//
Line 67: Line 67:
     }
     }
}
}
</lsl>
</source>


{{LSLC|Library}}
{{LSLC|Library}}

Latest revision as of 08: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);
    }
}