Booda Sack
Sphere Master
- 300
- Posts
- 20
- Years
- Age 38
- Ireland
- Seen Jul 30, 2007
I'll work on more in depth tut's but for the moment,here is a simple but very effective script.
I'll go through it.
First line sets the Alt key as the run key.
Then are some variables declared so you can set the Run/Walk sprite
Then the function for when the runkey is pressed/released
If you have questions,ask.
If you want to know more about sphere's built in functions check out the "doc_functions.txt" that comes with sphere.
Code:
BindKey (KEY_ALT, "OnRunKeyPressed()", "OnRunKeyReleased()");
var runsprite ="Hero.rss";
var walksprite="HeroRun.rss";
var running=false;
function OnRunKeyPressed()
{
SetPersonSpriteset("hero", LoadSpriteset(runsprite));
SetPersonSpeed("hero",2);
}
function OnRunKeyReleased() {
SetPersonSpriteset("hero", LoadSpriteset(walksprite));
SetPersonSpeed("hero", 1); // stop running
}
First line sets the Alt key as the run key.
Then are some variables declared so you can set the Run/Walk sprite
Then the function for when the runkey is pressed/released
If you have questions,ask.
If you want to know more about sphere's built in functions check out the "doc_functions.txt" that comes with sphere.