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...)
 
(Brushed up and added to category)
Line 1: Line 1:
<pre>
{{LSL Header}}
==Jack Launcher==
<lsl>
// SLetanque Jack Launcher by Babbage Linden
// SLetanque Jack Launcher by Babbage Linden
//
//
Line 18: Line 20:
     }
     }
}
}
</pre>
</lsl>
<pre>
==Boule Launcher==
<lsl>
// SLetanque Boule Launcher by Babbage Linden
// SLetanque Boule Launcher by Babbage Linden
//
//
Line 64: Line 67:
     }
     }
}
}
</pre>
</lsl>
 
{{LSLC|Library}}

Revision as of 08:09, 11 December 2007

Jack Launcher

<lsl> // 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);
   }

} </lsl>

Boule Launcher

<lsl> // 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);
   }

} </lsl>